How to disable and delete all editions in WordPress. WordPress

When writing and editing posts in WordPress, they are automatically saved - a backup copy of the post (revision) is made. With the help of revisions, you can restore an article by going back a few steps. To restore an article, you only need to select the required revision.

However, revisions are not always good. For storage backup copies Posts and articles require additional server resources. Revisions clog up the database, so it’s worth considering whether they are needed at all. Do we often use revisions when editing articles in WordPress? If not, you can disable them.

Disabling revisions in WordPress

To disable revisions in WordPress up to version 3.0.3 you need to go to the configuration file "config.php" and open it with text editor eg Notepad++. After this you need to find the line:

define("WP_POST_REVISIONS",0);

In case we have WordPress version 3.0.3 or newer — revisions are disabled in the “default-constants.php” file (located in the “wp-includes” folder). We are looking for the line:

define("WP_POST_REVISIONS", true);

After that, change true to false, as shown below:

define("WP_POST_REVISIONS", false);

Save the file “default-constants.php”. This way, revisions will be disabled.

All created revisions in WordPress can be easily deleted. In order to delete old revisions you need to go to phpMyAdmin and select a database. Then you need to go to the tab SQL and in the window that opens, insert the following line into the input field:

DELETE FROM wp_posts WHERE post_type = "revision";

An example is shown in the figure:

Then click the “OK” button and all previously saved revisions will be deleted. This method of deleting revisions is suitable for all versions of the WordPress engine.

Today's article will talk about WordPress revisions.

WordPress revisions are automatic saving of posts when editing. On the one hand, this is an excellent function: for example, you have been writing an article for more than an hour, when suddenly the electricity in the apartment is turned off, or the browser freezes, or the tab is accidentally closed... When this happened to me for the first time, thoughts immediately came to mind about how I’ll have to re-type the text, align the images, in general, do everything all over again, but no such luck! WordPress automatically saved my entire post! You won’t believe how grateful I was to the developers for such a feature.

But there is also another side to the coin. Default, WordPress revisions are done every 60 seconds and each revision is written to the database. Now calculate how many revisions you have on average per post and multiply by the number of blog posts. Wildly a lot! Half of the database size may consist of revisions. This is exactly what happened to me. See how the database size has decreased after deleting all revisions. Twice!

How to Disable WordPress Revisions

For disabling WordPress revisions open the wp-config.php file, it is located in the root of your site.

We go into it and add the following lines:

define("WP_POST_REVISIONS", 0);

The number in parentheses shows how many revisions are allowed for one entry. You can also specify the autosave interval in seconds (default 60).

Following the departing train called “all versions of WordPress up to 5.0,” I am writing this belated article about revisions or editions of WordPress. Why late? Because the WordPress revisions system will not work with the Gutenberg editor.

The WordPress revisions system

A frequently encountered name for what I want to write about is WordPress revisions. In Russian, it would be more correct to call this system function “WordPress Editions”. This is exactly how this function is translated in the console. The native name of this functionality is “The revision system”, which we translate as “Revision System”. I will refer to this system feature as WordPress edition.

So, WordPress editions are copies of articles saved in the database, which the administrator enters into the text editor field of the system.

Articles can be included in WordPress editions either after clicking the “Save” button in the editor or as a result of autosaving. Revisions of articles and pages are remembered by date and time.

Autosaving an article is automatic storage of material by the system, without the desire of the administrator. Autosave occurs periodically, every 2 minutes. Each subsequent copy overwrites the previous one. In the editor’s list, this copy is marked “Auto-save” (see screenshot below).

The more you work in the editor, the more autosaved copies will be in your site's database. If you add to them copies of saves made manually, then the garbage nature of this “Revision System” becomes obvious. More on this below.

WordPress Edition Settings and Management

Let's see how this tool generally works. We’ll look at all the possibilities on the “Edit Post” tab, the administrative part of the site. It works the same way in the page editor.

Attention! There are NO edit fields on the folds for adding records and adding pages.

Settings

To disable viewing saved revisions of an article (pages), which is enabled by default, go to the “Settings” button in the upper right corner of the “Edit Entry” page.

Here, traditionally, blocks are removed (added) by highlighting a check, without saving changes.

Control

The included Revisions block is at the bottom of the page. This is what he looks like. There shouldn’t be so many saved records of published material on a working website; it’s garbage and needs to be cleaned up.

  • As you can see, the ruler with the slider is all copies. The slider can be moved, calling one or another copy.
  • There are Previous and Next buttons, I don’t think there’s any need to explain their purpose.
  • The “Compare any two editions” checkbox is not highlighted; in the main fields we will see a comparison of the selected copy and the latest version of the text.
  • If you select the “Compare any two editions” checkbox, you can compare any two saved copies by calling them with the slider. In the main field in the comparison mode we see the texts of the two compared versions of the flock (pages).

For those interested in the original sources, there is a Help button that will give you a link to the WordPress.org Revisions page. The circle is closed, and we understand why this feature is called WordPress revisions.

Revisions are stored as child elements of the material. By default, the system tracks changes in title, author, content and announcement.

How to disable

By default, the system saves all revisions of both options (regular and auto). If you need them (revisions), you can limit them. To do this, in your wp-config file working theme enter the line:

define("WP_POST_REVISIONS", X);

Meaning X change to:

  • Zero (0) if we do NOT want to save anything;
  • -1, if we want to return everything as it was, by default;
  • Any number to order the number of saved copies you need.

Before reacting the wp-config file, don’t forget to check for a backup copy of the site. Or at least make a copy of the file before editing.

Opinion. I don't know why you should disable saving copies. Autosave has helped me out dozens of times when the connection with the server has been lost. It's better to clean them.

Cleaning copies

I repeat, revisions or editions of WordPress are technical garbage, which after the release of the site must be removed and ensure that it does not accumulate.

This can be done using cleaning plugins. About them in detail and. Or for fans, do everything manually, go to

Saving changes to posts can be very useful when working in WordPress. If something goes wrong and you lose information from a post, you can always access a previous saved version of your post by simply clicking on the link in the menu Editorial under the editor window.

Many, many revisions

If you've been working with WordPress for a while, then you've undoubtedly used this feature once or twice. But you've probably noticed that these changes tend to accumulate.

If you write a post in the editor, then WordPress saves the revisions automatically when you save the post. As a result, it is not uncommon to have more than 20 edits to a post. Multiply this by the number of posts on your site, and you get megabytes of additional posts stored in the database.

How to get rid of old editions

Some people don't like keeping all those old versions in their database. They believe that they are slowing down their site. This, however, is a myth.

WordPress developer Mike Little responded in a comment on WPBeginner, "WordPress queries to the database do not receive revisions, so the number of revisions does not affect the speed of the queries. The only time revisions are loaded on the page is when editing an individual post. And this does not affect page loading speed of your site."

However, many people still believe that having a small and lightweight database is a very good thing, and therefore they still prefer to get rid of their old revisions.

If you are one of them, then one of the three plugins below will help you do this.

1. Better Delete Revision

Better Delete Revision deletes old versions of posts and also optimizes your database.

The plugin page states: "By optimizing and deleting old editions, this plugin will make your database lighter and smaller over the course of its use. Removing old editions and optimizing databases is one of the best things you can do to keep your The blog worked as quickly as possible."

Take a look at the plugin settings page as well as the uninstallation process.

Plugin differs from Better Delete Revision in that it does not bulk delete your revisions, however, it will give you two features that Better Delete Revision does not have.

It allows you to first determine how many revisions have been saved.

And it allows you to delete individual revisions on the edit page.

3. Revision Cleaner

Plugin Revision Cleaner allows each user to set a time interval for automatic deletion its editions. This can be done on the user profile page.

Good afternoon everyone. Today I wrote for you a purely technical article that allows you to optimize your database WordPress blog by cleaning revisions (automatically saved copies of articles). We will take a detailed look at and analyze the purpose of revisions, their essence, and I will also show you how to delete and disable or limit the appearance of revisions in WordPress. The material published below will be accompanied by detailed pictures with comments.

As you can see, there are quite a lot of questions to study. True, for many owners of Internet resources it will not be new, but the “smartest” do not read my blog, it is read by those who want to learn. To create a popular, reliable and stable website, beginners need to understand all the technical intricacies and have a practical understanding of revisions and much more. Will learn.

What are revisions in WordPress

Maybe you noticed that while writing a post or editing, the system automatic mode makes a copy of it - a backup save. At this time, the “Publish” and “Save” buttons located in the window on the right become inactive. This action is called revision.

Revisions in WordPress are an automatic backup of the contents of a post or page to prevent data loss. From them you can restore earlier copies of documents.

Many people have probably guessed that WordPress revisions are used to avoid data loss. They are configured automatically and make a backup copy after a certain period of time (every 60 seconds). They are added to a database (MySql - phpMyAdmin). You can view the list of revisions in WordPress just below the post edit window (in edit mode). If you scroll the page, you can see them just below in the “Editors” window. They look like this:

You probably already have the question “Why delete or disable revisions?” if they play such a useful role. The whole problem is that copies of records, articles or posts greatly load the database into which they are entered. This leads not only to the future problem of editing and making changes, but also to slow loading of site pages. I advise you to read the post "". Search engines began to pay special attention to this parameter. Also, by the way, the behavioral factor directly depends on this, the indicator of which is formed from an assessment of user behavior.

Naturally, we need to get rid of revisions, no matter how useful they may be. This will not only reduce the size and volume of the database, but also load the site much faster.

How to Delete Revisions in WordPress

Exist different ways deleting revisions, I will show two. One is aimed at dummies, such as I was recently, and the second at people who are more prepared (who are not afraid of servers and databases).

Method number 1. Better Delete Revision plugin

We will use a specially created plugin for deleting revisions - Better Delete Revision. Download it via Admika and install it. After activation, an item with a name similar to the name of the plugin will appear in the settings section - these are settings.

You can immediately optimize the database or go to the “Check revision records” tab and from there clean your blog from unnecessary copies of documents.

Method No. 2.Deleting directly from the database

This one is a little more difficult to implement. I don't want to scare you, but if you are afraid of doing something wrong, then it is better to skip it. In this method, we will delete copies of articles directly through the database itself. Just before going there, I advise you to make a copy of it. If you don't know how to do this, then read the post.

After selecting the desired database, find the “SQL” tab, open it so that an empty field appears in front of you.

You need to copy the code below into it and click on the “OK” button. With this action you will do SQL query to remove revisions from the database.

DELETE FROM wp_posts WHERE post_type = "revision";

It should look like the picture:

If your actions are successful, you will see a message like the following in response. If you have not previously deleted or disabled revisions, then the number of lines will be different from zero.

How to Disable WordPress Revisions

In order not to waste time on cleaning each time, the creation of backup copies of articles can be disabled. Then your “Editors” window will simply disappear and permanent saving will stop happening. Before doing this, think very carefully, as you will no longer be able to open or return to previous version records.

To disable revisions, you need to go to your hosting and edit the wp-config.php file, which is located in the root folder. Paste the code with the parameter into it:

Define("WP_POST_REVISIONS", 3);

The number sets the number of document versions that will be stored in the database. Limit it to the number you need, for example one would mean you have one published and one backed up (last edited).

After finishing making changes, click on the “Save” button. Now your database will not swell like yeast dough every time you edit articles.

This is where I end this post. I hope this information was useful to you. If you have any questions, please leave them in the comments.