Website productionService provider Shangpin China: Students who use WordPress may have found that the ID of your articles is discontinuous.Why is this?The reason is that wordpress has the function of automatically saving drafts and revisions, so that every time it saves, a corresponding ID will be generated, and a large number of garbage files will be generated in the database.
Today I will talk about the method of cleaning up the database garbage files. It should be reminded that no matter which method you use, you should first make a data backup.
The first method is to delete directly in the database with SQL statements
There are many tables in the database, of which "wp_posts" is used to save all the relevant information of your articles. It is very important, and it generally stores the most data.We also clean the automatically saved drafts and revisions here. The command is as follows:
DELETE FROM wp_posts WHERE post_status!=’publish’ OR post_type=’revision’;
In fact, WordPress's functions of automatically saving drafts and retaining revisions can be disabled directly. However, I heard that the plug-ins in the new version have failed. The only way left is this code, which is troublesome to operate. So I'd better clean it every once in a while.
The second method is to use the "WP Cleaner" plug-in
Download the blog plug-in WP Cleaner and upload it to the wp content/plugins/directory;Log in to the blog background and enable the plug-in in the list of installed plug-ins;After enabling the WP Cleaner plug-in, the "WP Cleaner" option will be generated under the "Settings" tab;Click the "wp cleaner" option to enter the plug-in interface;The available deletion options are "Delete All Revisions", "Delete All Drafts", "Delete All Revisions and Drafts", and "Delete All Revisions - Inherit". You can click whichever item you want to delete.This article was published by Beijing Website Construction Company Shangpin China//ihucc.com/