How To Disable Post Revisions
By default Wordpress will keep all the revisions of your posts in its database. I don't know for you, but for me this means that for each post I have, there are 30-40 more post revisions behind it, causing my database to be unreasonably large and bulky.
There is a very easy way to change this and that is by adding the following line to your wp-config.php file:
define('WP_POST_REVISIONS', FALSE);
With this line you tell Wordpress to stop keeping revisions of your posts. Of course I understand that this might not be exactly what you are after. Perhaps you don't want to have 30-40 revisions for each of your posts but you would like to have the last or even the last 2 of your revisions always available for you in case you want to revert back to them. For this add the following:
define('WP_POST_REVISIONS', 1);
You can replace "1" with any number of your choice depending on how many revisions back you want to keep in your database.
How To Delete Post Revisions
Now that you have set the number of revisions that you like Wordpress to keep for you, it's time to get rid of all the rest of the revisions that are causing your database to be bulky and slow. To do this, go again to phpMyAdmin (like we did in the "Optimize Database Tables" section) and run the following SQL query:
DELETE a,b,c FROM wp_posts a WHERE a.post_type = 'revision' LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id) LEFT JOIN wp_postmeta c ON (a.ID = c.post_id);
That's it, your old revisions are now removed.
How To Set Up Wordpress To Automatically Empty The Trash
One last thing that you can do to avoid a bulky database is to empty the trash. By default Wordpress stores anything deleted in the trash folder for 30 days. This feature has been introduced with Wordpress 2.9 and it takes a lot of the database memory.
To decrease the number of days to let's say 10 and reduce the database memory occupied, add the following line in the wp-config.php file:
define('EMPTY_TRASH_DAYS', 10 );
That's it! From now on your database will be lighter and more responsive with your Website. Let me know if you have any problems with this.
Join the Discussion
Write something…
Pobman
Premium
I would not suggest most people run with W3 Total Cache, unless your server is setup right you will not see all the improvements from this plugin and you can actually make things worse. If you install it and you only have options for Disk caching, i.e. no APC etc. then I would just jump ship to Super Cache which pretty much works out of the box.
Running with the CDN though is a massive improvement for most people, I now run most sites with static content on cloudfront and the difference is out of this world.
FYI Cloudfront have added Sydney Australia to their CDN... makes them a winner in my book!
Nice guide though.
Running with the CDN though is a massive improvement for most people, I now run most sites with static content on cloudfront and the difference is out of this world.
FYI Cloudfront have added Sydney Australia to their CDN... makes them a winner in my book!
Nice guide though.
Denisara
Premium
smush it doesnt appear to work. it does nothing if I 'mass smush' and if I do them one at a time (and I have 364 pics) it times out. any suggestions? here is the error message I am getting: Automatic smushing has been disabled temporarily due to an error. Operation timed out after 20071 milliseconds with 0 bytes received
i tried a few more pics to "smush" and now they show up "BLANK" how do i get them back? this does NOT work
case in point:
http://bonestrivia.com/bones-season-eight-begins/bones-season-eight
this is one pic "smushed" out of about 12 that i tried this on. how do you reverse this ??????
i guess i have to redo that work completely if I want pictures to show UP
i tried a few more pics to "smush" and now they show up "BLANK" how do i get them back? this does NOT work
case in point:
http://bonestrivia.com/bones-season-eight-begins/bones-season-eight
this is one pic "smushed" out of about 12 that i tried this on. how do you reverse this ??????
i guess i have to redo that work completely if I want pictures to show UP
Denisara
Premium
funny, I was told that W3 Total Cache is a mistake to use unless you get like over 10k visitors per month by either Jay, Kyle or Carson...among others. The rest of what you say to do does not make sense to a newb such as myself but thanks for the article...maybe it will help someone else
morlandroger
Premium
WOW this is very comprehensive! Will come back to it and look at some of my sites again with a view to speeding up load times. Thanks for this