portheavy.blogg.se

Wordpress revisions
Wordpress revisions




Even if you are not exporting your database to import into Pantheon, this is just good database hygiene.This article is all about making your WordPress website cleaner, faster and optimized. Simple Revisions Delete lets you delete your posts' revisions individually or all at once (purge or bulk action). WP Sweep uses proper WordPress delete functions as much as possible instead of running direct delete MySQL queries. WP Optimize Cache is an all-in-one WordPress performance plugin that caches your site, cleans your database and compresses your images. Wp post delete $(wp post list -post_type='revision' -format=ids)įinally, if you would prefer to stay away from commands altogether, there are a few plugins that will help clean up database revisions. If you prefer to use the command line, you can use this command: By adding this line, you can limit posts' revisions to five, resulting in a smaller database. That is a lot of deleted statements and it will affect your blog's performance.Īnother option is via wp-config.php. However, I do not recommend that as it will be executed every time anyone visits a page on your blog. It is safe to leave the line in your functions.php. You only need to do it once and all the old revisions are gone. It does, however, require being comfortable with PHP code. If you are not comfortable issuing commands directly to your database, there is another way. Once you've visited your home page, you can re-open functions.php and remove that line and save the file again. Save it, now open a browser and visit your blog. Somewhere near the top of your functions.php file - but AFTER the opening post_type) || ('page' = $post->post_type) ) $num = 5 Open the functions.php file for your site. This is by far the easiest way.Ĭonnect to your database using the MySQL Command Line tool or your favorite SQL tool.Ĭopy and paste this command into your command window once connected.ĭELETE FROM wp_posts WHERE post_type=”revision” īoom goes the dynamite. If you have the MySQL command line tool installed you can issue the command directly. The latter 33 records are not necessary and could easily be done away with. Using the database that powers my database, this returns 34 rows: the original and 33 revisions. The first SELECT picks up the parent record, the next one picks up all the revisions. In my wp_posts table, that page id is 302. That is an old page on my site, originally created many years ago, so it has some history. I use it when people ask me to speak and want a bio, picture, etc. I am arrogant enough to have an Electronic Press Kit on my blog. Let's take a look at a single post to see what that looks like in detail. Looking at it, 2,464 of those records are historical revisions. For verbose writers like myself, this can be a problem.Ĭurrently, the wp_posts table in my personal blog contains 10,820 records. The problem is that each of these records contains a complete copy of the entire post.

wordpress revisions wordpress revisions

Sadly though, WordPress has yet to incorporate a DB Cleanup feature that allows you to specify something like "Remove revisions after 30 days" or something. However, once a post goes live, I rarely need those revisions.

wordpress revisions

This is a very good thing: it has saved my bacon on more than one occasion.

wordpress revisions

As you make changes and save them - whether in draft mode or published - WordPress stores a "Revision History" for each post. (100MB for files uploaded, 500 MB for files passed in via URL.) One easy way to lower the size of your database is to remove all the "revision" records in the Posts table. Normally it is not a problem but if you are preparing to export a large WordPress-powered site to Pantheon, you could quickly hit the limits of our importer. The fact that revisions stack up in your database is one of these holes. WordPress is a wonderful tool, but there are still a few holes in its architecture. Removing all the “Revision” Records in the Posts Table Fortunately, there are several things you can do to shrink it and here are a few quick ways to remove some unneeded records, reduce the size of your overall export and clean up your database as well. One of the factors that determines the size of that tarball is your database export. If it's too large, it is unable to be imported. However, one of the limitations to that import process is the size of the tarball you create. Migrating a WordPress site onto the Pantheon platform is an easy process and can be done with just a few clicks.






Wordpress revisions