How to disable WordPress revisions. How to remove wordpress revisions? get rid of excess trash! How to remove revisions in wordpress

When creating, editing and saving articles and their drafts in WordPress, by default, post backups are automatically created, commonly referred to as Revisions or Revisions(revisions).
Saving revisions is of course useful, because for example, in case of errors in the formatting of material, failures of your computer or server, you are given the opportunity to restore any of the previous versions of your recording. But the functionality of saving revisions has a negative side.

After all, all backups (revisions, revisions) are stored in the database of your blog, in the table wp_posts. And if you have created a lot of records, and at the same time they were often edited, then the size of the database will be too large. In addition, the execution of queries to the database will slow down.

You can see the list of available revisions at the bottom of the post editing page:

Revisions, wordpress post revisions

Disable, Limit, Delete WordPress Revisions turns out not to be difficult at all.
Let's take everything in order using WordPress 3.3.1 as an example.

Just don't forget to back up your database before making any modifications!

Disable Revision in WordPress

In order to disable the creation of revisions (revisions), you need to add one line to the file wp-config.php

Define("WP_POST_REVISIONS", 0);

Define("WP_POST_REVISIONS", false);

There is another option to disable revisions - change one of the values ​​from "true" to "0" or "false" in the function wp_functionality_constants(), which is in the file /wp-includes/default-constants.php

Function wp_functionality_constants() ( ... if (!defined("WP_POST_REVISIONS")) define("WP_POST_REVISIONS", false); ...

Limit the number of revisions in WordPress

In order to limit the number of revisions (revisions), you need to add one line to the file wp-config.php, as it was when disabling revisions, but instead of the value "0" or "false" specify an integer:

Define("WP_POST_REVISIONS", 3);

In this case, a maximum of 3 revisions per article will be created, plus one "Auto Save" copy.

Note to memory:
Making the above changes will not immediately reduce the number of revisions that already exist in the database. But the changes will take effect when you update existing records, and individually. They will also be taken into account when creating new entries. It is also worth considering that in edit mode, in addition to revisions in the database, every 60 seconds one single copy of the entry will be recorded as "Autosave".

Remove all WordPress revisions from the database

If your blog has been around for a long time and there are a lot of entries in it, then it does not hurt to optimize its database by deleting previously created revisions (editions), and thereby reduce the size of the table wp_posts.

Attention! Don't forget to back up your database before deleting all revisions! Otherwise, it will no longer be possible to restore deleted revisions.

So, we need to do a few things:

1. Log in to your database control panel, such as phpMyAdmin;
2. Select by name the database that is used by your blog;
3. Click on the button (or tab) labeled "SQL" (usually at the top of the page);
4. In the field for SQL queries, enter this query:

DELETE FROM wp_posts WHERE post_type = "revision";

5. Click the "Ok" button to complete the request;

That's all. Now the database of your blog, and more specifically the table wp_posts, greatly reduced in size.

Finally, I want to say that the above revision deletion example(revisions) is the simplest and not flexible. You may want to delete not all revisions, but selectively, for example, leaving the last three revisions in each entry. In this case, you will either have to perform a more advanced query in the database, or use a special plugin. Fortunately, there are plenty of plugins for managing revisions and databases.

Most WordPress users are not even aware of the concept of “WordPress revisions”, however it is useful to have an idea of ​​what it is, and in some rare cases it is desirable to know how to disable these revisions.

So, revisions (or revisions) are copies of your posts that are created every time you save or autosave a page when it changes. This is done in case you want to return to some previous edition of the text or in case of an unexpected failure in the computer or communication.

I think that if you do not have any problems with the site, it does not have a large database that you would like to reduce and there are no comments on the speed of page formation, you should not worry about the presence of editions on the site.

You can see the generated revisions (in terms of Russian WordPress) under the editing window.

Navigating to any of the text revisions in the list will return the text to a state that corresponds to the time that revision was saved.

As we can see, there can be many revisions for each entry, and for a site with a large number of entries, they can take up a significant amount of disk space, which can eventually lead to problems in its operation.

For small sites this is irrelevant, but if you have thousands of records and each is presented in several editions, this can significantly increase the size of the database. Firstly, it slows down the work with the database, secondly, these records take up space on the hosting, and thirdly, which, for example, was relevant for me, it can interfere with the automatic backup of your data. I have site data regularly automatically archived by the plugin and sent to a specific e-mail. If the archive exceeds the size limit for e-mail, this technology stops working.

Revision setup

How do you remove wordpress editions? First, you can specify the following statement in the wp-config.php file (located in the root folder of your site):

define("WP_POST_REVISIONS", 0);

which means keeping only the last three revisions.

You can delete revisions that have already accumulated in the database in at least two ways.

1. Deleting directly in the database

We go into phpMyAdmin then to the desired database. Then in the top menu, go to the tab - "SQL". A window will appear in which you need to enter the SQL command:

And press the button below - "OK" (or "Forward"). All editions removed.

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

Lots and lots of 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 add up.

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 revisions of a post. Multiply that by the number of posts on your site and you have megabytes of extra posts stored in the database.

How to get rid of old revisions

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

WordPress developer Mike Little responded in a comment on WPBeginner, "WordPress database queries do not retrieve revisions, so the number of revisions does not affect query performance. The only time revisions are loaded on a page is when editing a single post. And this does not affect page loading speed of your website.

However, many people still think that having a small and light database is very good, 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 just that.

1. Better Delete Revision

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

The plugin page says "By optimizing and deleting old revisions, this plugin will keep your database lighter and smaller throughout its use. Deleting old revisions and optimizing databases is one of the best things you can do to make your the blog worked as fast as possible."

Look at the plugin settings page as well as the removal process.

plugin differs from Better Delete Revision in that it doesn't bulk delete your revisions, however, it will give you two functions 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 of his revisions. This can be done on the user profile page.

Today's article will be about WordPress revisions.

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

But there is also the other side of the coin. Default, WordPress revisions are made every 60 seconds, and each revision is written to the database. Now calculate how many revisions per post you have on average and multiply by the number of blog posts. Lots of wild! The size of the database can be half of the revisions. That's exactly what I had. See how the size of the database has decreased after deleting all revisions. Twice!

How to Disable WordPress Revisions

For disabling WordPress revisions open the wp-config.php file, it lies at the root of your site.

We go into it and add the following lines:

define("WP_POST_REVISIONS", 0);

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

In the wake of the “all WordPress versions up to 5.0” train, I am writing this belated article about revisions or revisions of WordPress. Why belated? Because the WordPress revisions system with the Gutenberg editor will not.

The WordPress revision system

A common name for what I want to write about is WordPress revisions. In Russian, it is more correct to call this function of the system “WordPress Editions”. This is how this function is translated in the console. The native name of this functionality is "The revision system", which translates as "The revision system". I will refer to this system feature as WordPress revisions.

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

Articles can end up in WordPress revisions, 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.

Article autosave is automatic storage of material by the system, without the desire of the administrator. Autosave occurs periodically, every 2 minutes. Each next copy overwrites the previous one. In the list of revisions, this copy is marked "Autosave" (see the screen below).

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

WordPress Edition Settings and Management

Let's see how this tool actually works. We will see all the possibilities on the “Edit post” tab, the administrative part of the site. It works the same way in the page editor.

Attention! On the folds of adding records and adding pages, there are NO revision fields.

Settings

To remove viewing of saved revisions of an article (pages), by default it is enabled, we turn to the "Settings" button in the upper right corner of the "Edit Post" page.

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

Control

The included "Editions" block is located at the bottom of the page. He looks like this. On a working site, there should not be so many saved records of published material, this is rubbish, it needs to be cleaned.

  • As you can see, the ruler with the slider is all copies. The slider can be moved, causing this or that copy.
  • There are buttons Previous and Next, I think it is not necessary to explain their purpose.
  • The check “Compare any two editions” is not highlighted, in the main fields we will see a comparison of the selected copy and the last version of the text.
  • If the "Compare any two revisions" checkbox is selected, 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 options in packs (pages).

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

Revisions are stored as children of the story. By default, the system tracks changes in the 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) can be limited. To do this, in the wp-config file of your 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 copies you want to keep.

Do not forget to check the availability of a backup copy of the site before the wp-config file reacts. Or at least make a copy of the file before editing.

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

Cleaning copies

To reiterate, revisions or revisions of WordPress are technical junk that needs to be removed after the release of the site and ensure that it does not accumulate.

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