disable wordpress post revisions and increase wordpress performance. For improving the WordPress website or blog performance you need use following method.
WordPress saves the post revisions after every 2 min. That takes so much mysql storage.
To save MySQL storage, some WordPress user will be happy using this method, this method is Disable WordPress Post Revision.
how to disable wordpress post revisions
Why we need disabled this featured?
It’ because WordPress created such as dummy data revision and this one make our table sized increased. And if you have limited space, this is bad idea, and of course disable Post Revision also made your WordPress running faster.
Open your wp-config.php file and put the following code in that file. If you are not wordpress developer then dont use following code. Please consult with any wordpress developer for this code.
Earlier I have blog in wordpressmu then after wordpress 3.0 version I decided to migrate to new version. I exported my all posts by using the wordpress export tool. Then I imported data into new wordpress installation. I got all my posts and category and all the data. Then I checked all my attachments.
Then I saw my media library I saw all the images listing are there but images are not showing in media library. Media Library not displaying images after importing posts. I personally faced issue and got frustrated. then I solved issue myself using mysql query trick.
Media Library not displaying images after importing posts
When I checked my database I saw the all the my attachments are listed in post table but images are not displaying. All the places I only saw the wp-includes/images/crystal/default.png image.
I did spend one hour googled for solving the issue but I did not find any solution for this. Than again I checked my Folder permissions and images files but I found all things are perfect.
Then I checked my database and I found the issue. in wp_posts table ->post_mime_type column one entry was missing. After seeing that issue I fixed the issue.
I used the following mysql quires using myphpadmin tool.
[viral-lock message=”Solution code is Hidden! It’s Visible for Users who Liked/Shared This article on Facebook or Twitter or Google+. Like or Tweet this article to reveal the content.”]
Update wp_posts set post_mime_type='image/jpg' WHERE guid like '%jpg%'
Update wp_posts set post_mime_type='image/jepg' WHERE guid like '%jepg%'
Update wp_posts set post_mime_type='image/png' WHERE guid like '%png%'
Update wp_posts set post_mime_type='image/gif' WHERE guid like '%gif%'
[/viral-lock]
After using above query I checked the my media library. I am able to see my all images in media library.
My advise to you is first take backup of your database and then use above mysql quires. Then use the above queries.
If you are imported post from other website then use following commands also.
UPDATE wp_posts SET post_content = REPLACE(post_content, 'NEW-DOMAIN-NAME', 'files/');
UPDATE wp_posts SET post_excerpt = REPLACE(post_excerpt, 'NEW-DOMAIN-NAME', 'OLD-DOMAIN-NAME');
UPDATE wp_posts SET guid = REPLACE(guid, 'NEW-DOMAIN-NAME', 'OLD-DOMAIN-NAME');
Above quires will change the domain location of file.
Many times you want to show the popular posts in your wordpress theme and you use popular post wordpress plugin or widget for showing the popular posts in your wordpress theme. As much possible you need to avoid the wordpress plugins for minimal code.
most popular posts wordpress without plugin
With very easy steps you can fetch the most popular posts from your wordpress. Most common trick or technique is on comments base you can fetch the popular posts.
You just need to open your functions.php file from wordpress posts and put following code in file.
// Get Most Popular Posts in theme
function popular_posts_by_comments( $posts = 5) {
$popular = new WP_Query('orderby=comment_count&posts_per_page='.$posts);
while ($popular->have_posts()) : $popular->the_post();
?>
<li>
<div>
<a title="<?php the_title(); ?>" href="<?php the_permalink() ?>"><?php the_title(); ?></a>
<span><?php comments_popup_link('0 Comment', '1 Comment', '% Comments', 'comments-link', ''); ?></span>
</div> <!--end .info-->
<div></div>
</li>
<?php endwhile;
}
This is very easy code to fetch you wordpress popular posts. Here I am fetching only 5 popular posts from wordpress. You can fetch the multiple popular posts by changing the $post variable value.
In wordpress theme sidebar or footer section if you want to show the popular post then just use following code.
creating sub domain for wordpress images is best way to increase your wordpress site speed. We given steps to, how to serve wordpress images from sub domain. Many shared hosting and wordpress bloggers and websites are using the apache web server for hosting the wordpress sites. Apache Web server is having his own rules and behavior. By default when you open webpage of your website. That time you are making so many requests to apache web server with same domain name. That will create queue to apache web server with same domain name.
how to serve wordpress images from subdomain
For reducing the load time you should keep image file on different sub domain. Means though image subdomain you can send a parallel request to Apache web server. It will reduce the concurrent connections to web server. WordPress provides the functionality to set different domain or sub domain for images.
In this article I will show you how easily you can set the wordpress images from sub domain. First create subdomain through your control panel. Use following step for creating subdomain.
I recommend to create the images subdomain because images subdomain is good for SEO. Here I created the purabtech.in/files/ subdomain for my images. Then set your wordpress images path in document root setting. Normally your wordpress images are stored in wp-content/uploads directory. You can use following setting for setting the document root.
After creating subdomain for images and setting up the correct document root for images subdomain. Go to your wordpress admin panel. From right side panel you should go to settings -> Media panel. This page will look like as follows:
In “Full URL path to files” textbox put your image subdomain name and click on save changes button. Uncheck the organize my uploads into month- and year-based folder option because which is not good for SEO purpose.
After this your images will come from image subdomain but old uploaded image files will still come from older location and same domain. For changing the older images file location and domain information you should use the following steps.
Go to your Mysql databases and select the your wordpress database. You can use the phpmyadmin sql manager for this or you can use command prompt for this if you are having dedicated hosting server. If you taken shared hosting then I recommend to use PhpMyAdmin.
Use following two SQL query: (Note: You should use your images subdomain and your domain name in SQL query)
UPDATE wp_posts SET post_content = REPLACE(post_content,'http://images.purabtech.in/','http://images.purabtech.in/');
UPDATE wp_posts SET guid = REPLACE(guid,'http://images.purabtech.in/','http://images.purabtech.in/');
After this your old images files will point to images subdomain. If your images and wordpress website is old then google and other search engines already indexed your images. So We need to write the redirection rewrite rule for images in your .htaccess file. This file you will find in your Root directory of wordpress installation.
Use following line of code in your .htaccess file.
RewriteEngine On
RewriteBase /
RedirectMatch 301 ^/wp-content/uploads/(.*)$ http://images.purabtech.in/$1
Above all steps are important to change the wordpress images into images subdoamin. If you are having any issues or questions about this article. Then please write to me.
When we are using the wordpress sites then we need to clean the database always. If your site is having more than 500 articles then you need to worry about server performance.
How to Optimize Your WordPress Database using plugin
Mysql load will impact your server. Many people are suggesting to use the WP-DBManager wordpress plugin. But forgot about plugin feature. That plugin specially made for database backup and managing the tables.
If you want to optimize your wordpress database then you need to use wp-optimize wordpress plugin. I found that is only plugin is helpful for really keep optimize your wordpress database.
I used that plugin. Before using that plugin my mysql database size was 135mb. After using that wp-optimize plugin features database size was 4mb. That means my database really optimized. My sites performance was also improved.
I really liked this wordpress plugin. Thanks to Ruhani Rabin who wrote this plugin.
Simple but effective plugin allows you to extensively clean up your WordPress database and optimize it without doing manual queries.
What is features of wp-optimize?
Enable/Disable trackbacks for all published post
Enable/Disable comments for all published post
Removal of stale post revisions
Removal of stale unapproved and spam comments
Removal of trashed comments
Removal of akismet metadata from comments
Removal of other stale metadata from comments
Mobile device friendly, now you can optimize your site on the go
Removal of all trackbacks and pingbacks
Cleaning up auto draft posts
Removal of transient options
Clear out the post trash
Automatic cleanup of all the integrated options (also uses retention if enabled)
Ability to keep selected number of weeks data when cleaning up
Option to add or remove link on wp admin bar.
Enable/Disable weekly schedules of optimization
Apply native WordPress MySql optimize commands on your database tables without phpMyAdmin or any manual query.
Display Database table statistics. Shows how much space can be optimized and how much space has been cleared.
Enabled for Administrators only.
Every-time you save a new post or pages, WordPress creates a revision of that post or page. If you edit a post 6 times you might have 5 copy of that post as revisions. Imagine if your post or pages are long and big. It is a huge number of bytes that’s on your MySQL overhead. Now WP-Optimize allows you to optimize and shrink your posts table by removing not necessary post revisions from the database. As example, if you have a post which is approximately 100KB data and you have 5 revisions of that post, the total space wasted is about 500KB. And if you have 100 posts similar to it, you have 50MB database space wasted.
Now WordPress in core the new post thumbnail function will not changed until. we have given info about How to use the the_post_thumbnail In WordPress.
use the the_post_thumbnail In WordPress
You can provide 4 picture formats to the function (change the width and height values to your need):
// the thumbnail
the_post_thumbnail(array(100,100));
// medium resolution
the_post_thumbnail(array(300,200));
// large resolution
the_post_thumbnail(array(600, 400));
// original
the_post_thumbnail();
You can set how the images should align. It is also possible to assign an own class:
// left align
the_post_thumbnail(array(100,100), array('class' => 'alignleft'));
// right align
the_post_thumbnail(array(100,100), array('class' => 'alignright'));
// center
the_post_thumbnail(array(100,100), array('class' => 'aligncenter'));
// align right and the class 'my_own_class'
the_post_thumbnail(array(100,100), array('class' => 'alignright my_own_class'));
The 3rd possibility is the control of the images size with an array of height and width:
For this purpose we suppose that the settings for thumbnail is 150×150, for medium 300×200 and for large 600×400.
// thumbnail scaled to 60x60 pixel
the_post_thumbnail(array(60,60), array('class' => 'alignleft'));
// original thumbnail
the_post_thumbnail(array(150,150), array('class' => 'alignleft'));
// medium resolution scaled to 200x133 pixel
the_post_thumbnail(array(200,200), array('class' => 'alignleft'));
// large resolution scaled to 400x266 Pixel
the_post_thumbnail(array(400,345), array('class' => 'alignleft'));
We see that the image proportions are always maintained, even if one specifies crooked values.
For the Theme Designers is this not necessarily easier, because no one knows what the user will put in his settings o his library. One way to approach this problem, to query the options for the various sizes:
// width of the thumbnails
get_option('thumbnail_size_w');
// height of the thumbnails
get_option('thumbnail_size_h');
// height of the medium resolution
get_option('medium_size_h');
// width of the large resolution
get_option('large_size_w');
// 1 = Crop thumbnail to exact dimensions, 0 = Crop off
get_option('thumbnail_crop')
Here another example: If the size of a thumbnail is bigger than 100×100 and crop is activated, then the thumbnail should be resized to 100×100, otherwise use the original thumbnail.
When you publish your post,the feed an published to the whole world.That’s very annoying thing. publish wordpress feeds later, That is always good from SEO.
How to publish wordpress feeds later
Some times you need to change the content or change the url, that time you got the errors
The following example publishs the post 10 minutes later in your feed:
/**
* puplish the content in the feed later
* $where ist default-var in WordPress (wp-includes/query.php)
* // Apply filters on where and join prior to paging so that any
* This function an a SQL-syntax
*/
function publish_later_on_feed($where) {
global $wpdb;
if ( is_feed() ) {
// timestamp in WP-format
$now = gmdate('Y-m-d H:i:s');
// value for wait; + device
$wait = '10'; // integer
// http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timestampdiff
$device = 'MINUTE'; //MINUTE, HOUR, DAY, WEEK, MONTH, YEAR
// add SQL-sytax to default $where
$where .= " AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, '$now') > $wait ";
}
return $where;
}
add_filter('posts_where', 'publish_later_on_feed');
You need to open the your wordpress themes functions.php file and put above code in that file. Using this function your feed will publish after 10 minute of your wordpress post publishing.
You cannot change a WordPress.com account username once it has been set. However, you can change what is seen on your posts and comments by changing the display name (nickname) in your profile, or you can create a new account and transfer your blog(s) to the new account.
How to wordpress change admin username
Change Display Name (Nickname)
1. Access your User Profile
2. Change the value next to Display name publicly as under Basic Details
3. Click Update Profile.
↑ Table of Contents ↑
Change Username
1. Log into your current account (using your existing username)
2. Access your Personal Settings and change the e-mail address to another email address. This will free up your primary e-mail for use with the new username.
3. Once the new address has been verified via email confirmation, log out of the account.
4. Go to http://wordpress.com/signup/ and attempt to register a new account (the username you wish to change to) with your e-mail address.
5. If you’ve got a blog you should transfer its ownership to your new username.
Once you’ve done all of that you’ll be rocking WordPress.com with your new username.
In article, I explained you the 5 best tips about how to keep your wordpress blog or website impressive and 5 tips to increase wordPress traffic and look. It is very important to increase wordPress traffic by doing some tricks. There are many ways for increase wordPress traffic. But here in this article, I found some very unique increase wordPress traffic tips which are very useful for every web master.
I also did many tricks for my client to increase wordPress traffic. So think deeply about, how to increase wordPress traffic.
increase wordPress traffic
WordPress is becoming most popular CMS these days. It is very easy to use and great search engine support. Following are simple steps which I used to increase wordPress traffic.
Last year wordpress left behind all the cms. Many people are thinking about how to keep the there wordpress site impressive.
In this article I am going tell you the 5 best tips about how to keep your wordpress blog or website impressive.
1. Create a widget controlled footer that keeps visitors busy on site
Widget controlled footer is not new thing in wordpress website but still having footer with multiple information is good.
You should keep the following footer widget in website.
1. Recent posts
2. Popular Post
3. Recent Comments
For recent comments you can use following code in footer without plugin
<?php
$my_query = new WP_Query('showposts=15');
while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate = $post->ID;
?>
For popular post We can use the wp-popular-post plugin. Using that plugin use can use following code in your website
You can increase wordPress traffic and website will look cool with best custom made images.
You can use following code for showing the images on homepage.
First you need to open the functions.php file from your wordpress theme folder and copy paste following code in that file.
In your index.php file you need to copy paste the following code for showing the image.
<?php get_first_image($post->ID); ?>
3. Add social media links to the bottom of post
Visitors always want to bookmark the website or your posts.
So keeping that very simple adding the social media links to your posts is very nice.
Finding the good social media icons as per your website is very easy with google.
There are some nice wordpress plugins available for adding the social media icons but recommend not to use any wordpress plugin.
Or you can use following code.
4. Install the Tweetmeme style Twitter button to your posts
Twitter is very popular these days. Twitter is micro blogging website.
So many people want to share there articles with twitter and Many visitors want to share article with there friends and follower by tweeting the article.
I recommend to use the tweetmeme wordpress plugin for putting the Twitter button to your posts.
You can download the tweetmeme wordpress plugin from following URL
http://tweetmeme.com
5. Always show the Author information with photo
Many visitors want to know about author. Keeping Author’s information on wordpress website is really good idea.
That will become your website more interesting the user friendly to visitors.
Some people like the specific writing style of author and They want know more information about Author.
In wordpress keeping the users photo and information I will suggest to use the user-photo wordpress plugin.
http://wordpress.org/extend/plugins/user-photo/
After adding following plugin you can use following code in your wordpress posts.
Saying thank you is always good manners. In article, i have code for, add thank you message after wordpress comments after adding comments added by users. I got the same request from many of clients for adding the thank you message after putting comments after by the user who comes to site.
It was good to have this functionality. User will remember your site and you should send the thank you email to user for adding the comment to your wordpress website. For professional sites, it is very great functionality.
add thank you message after wordpress comments
In this article I will show how to add custom message after getting comments from users. For this we going use the wordpress api. WordPress filters are very useful. You can find all wordpress hooks and filters in wp-includes/default-filters.php file.
Method First
add_filter('comment_post_redirect', 'redirect_after_comment');
function redirect_after_comment($location){
$newurl = substr($location, 0, strpos($location, "#comment"));
return $newurl . '?c=y';
}
if($_GET[ 'c' ] == 'y'){
echo 'Thank you your comemnt';
}
Open your functions.php file from your active wordpress theme folder. copy paste the following code in that file. This is very simple trick but still it is really useful.
Method Second
For this method you need to create the “Thank you” page in wordpress site than open functions.php file and put following code in that file.
// Redirect to thank you post after comment
add_action('comment_post_redirect', 'redirect_to_thank_page');
function redirect_to_thank_page() {
return 'https://purabtech.in/thank-you';
}
Note: do not forget to change your URL thank you URL from code. Above code will work in new wordpress versions.