Today's article, the surprise found that the article ID unexpectedly has reached 19. In view of my previous experience of tossing WordPress, I know this is WordPress's "automatic save and article revision function" at the mischief. But how to turn off WordPress's function?! Or ask "valley teacher".
After the "Valley teacher" guidance, found a solution. In fact, simply add the following code to the wp-config.php:
The code is as follows |
Copy Code |
Define (' Autosave_interval ', 120); Set automatic save interval, in seconds, default 60 Define (' Wp_post_revisions ', false); Disable Article revision feature Define (' Wp_post_revisions ', 3); // |
According to your needs to put the above three lines of code into the wp-config.php, if you do not know where to put the file, the file has a lot of define the beginning of the code, and they can be put together.
It's simple, like these two features are cumbersome and useless, and if you just want to know, writing this article makes no sense. You may not even know exactly what the difference is between automatic saving and article revisions, and who is the culprit in getting database data to swell.
So let's go ahead and take a look at these two things.
Auto Save (Auto-save)
This is a very practical function, when you edit the article, WordPress automatically save your input every 60 seconds, to prevent computer hanging or power loss of the results of hard work. This feature is different from automatic revision, you don't have to worry about it will let your database data bloat, because it will only create a record, every 60 seconds update, when the article released, the record of the Post_status will change from draft to publish, there is no waste of places.
The only thing that can bring you trouble is that the save interval is too short, the server is uncomfortable, write an article may have intermittent card feeling, then you can set the time a little longer.
Define (' Autosave_interval ', 120); Set automatic save interval, in seconds, default 60
If you prefer to edit in Word and then copy it to the WordPress editor, you can disable the AutoSave feature altogether, adding the following code to the subject's functions.php
The code is as follows |
Copy Code |
function Disable_autosave () { Wp_deregister_script (' AutoSave '); } Add_action (' wp_print_scripts ', ' disable_autosave '); |
Side effects after disabling: The preview feature is not available and must be saved as a draft to preview
If the server is good, this automatic save function basically does not affect anything, Sola used 60 seconds to save an automatic save, like to use WP editor side of the write side preview, often late WP menu (now the menu mouse will pop-up submenu, it is easy to point fault), if not 60 seconds of automatic save, I don't know how much time I have to waste to edit again.
Article revision (post revisions)
When editing the article, if the title, content or summary of the field changes, WordPress will save the current version as a revised version, to facilitate you want to return to the previous version, which is a bit like SVN work style. The problem with this is that the database will be very large with a revised version, plus the ability to save automatically, making the revision function somewhat cumbersome.
We can control the number of revisions, for example, an article saves up to 3 revisions
Define (' Wp_post_revisions ', 3);
In this way, each creation of an article, the database will have 1 auto-save+ up to 3 revision.
or completely disabled
Define (' Wp_post_revisions ', false);
You can completely delete revisions and associated meta information by running an SQL statement
The code is as follows |
Copy Code |
DELETE A,b,c from Wp_posts a Left JOIN Wp_term_relationships b On (a.id = b.object_id) left JOIN Wp_postmeta C On (a.id = c.post_id) WHERE a.post_type = ' revision '; |
about automatic drafts
Automatically saved records are called drafts, and a record is called an automatic draft, which is automatically created when you click to write an article.
If you click to write an article:
Input, automatic save effective
Save an article as a draft manually
Publish Articles
Automatic draft records are converted to drafts or articles so that no spam data is generated.
If you click to write an article, did not write off, it produced an automatic draft garbage records, modify this problem need to change the source code, if interested can Google, but if you can develop a good habit of writing articles, automatic quadrochromatic is not a problem, WordPress has some recycling mechanism, For example, automatically clears a 7-day old automatic draft every time a new article is created.
Manage different versions of articles with Plug-ins
There are plug-ins to help us clean up the database and manage the various versions of the article.
Wp Cleaner
The use of caution do not accidentally delete quadrochromatic, sometimes we will not write the article to save as bad, delete the miserable.
Revision Control
If the use of dapper to describe WP Cleaner, then revision control is spite, powerful, relatively complex interface.