Web Design
Mobile Internet
Brand Design
Innovative
News
Encyclopedias

Solution to Discontinuous WordPress Article IDs

Date:2013-03-29 Source: Shangpin China Type: website encyclopedia
Word Size: small   medium   big

Beijing website construction Company Shangpin China: Recently, many friends mentioned that "WordPress article ID is discontinuous". What should we do?, In fact, I found this problem when I first contacted WordPress, so I hid the automatic saving and article revision functions of WordPress from the beginning. But fixed links may not be found if they are not named by postid, but this is the kind of fixed link that scallion has always used. If your network speed is poor, it will affect the editing of articles and the loading speed of published pages; In addition, every automatically saved article draft will be automatically written into our database, which will greatly increase the storage of the database. If there is too much redundant data, the efficiency of the database will also be affected. In addition, the article ID mentioned earlier is discontinuous.

The WordPress dashboard does not directly provide the option to turn off this function, so today I will tell you how to completely hide this function.

Method 1:

The code comes from a foreign website. The use environment is WordPress 3.3.1. In principle, it is supported above 3.0. WP3.0. x Scallion has not been tested. Add the following code to the functions.php file of our current theme:

/*Cancel Auto Save and Revision*/

remove_action('pre_post_update', 'wp_save_post_revision');

add_action('wp_print_scripts', 'disable_autosave');

function disable_autosave() {

wp_deregister_script('autosave');

}

Method 2:

WordPress automatically saves articles every 60 seconds by default, which I personally think is too frequent. Then we can open the wp-config.php file in the root directory of the blog, search for "require_once (ABSPATH. 'wp settings. php');" and add the following code before/above it:

//Auto save every 10 hours

define('AUTOSAVE_INTERVAL', 36000);

//Cancel Auto Revision

define('WP_POST_REVISIONS',false);

Clean up previous article history revisions in the database

We have solved the problem of automatic saving and revision. Next, we will delete redundant articles and revisions in the database. Before database operation, we suggest that you back up. We log in to phpmyadmin for database management, and write the following running code in the SQL statement command line to execute (if you change the prefix of the database table name, you need to change the wp in the data table name to your prefix):

delete from wp_posts where post_type='revision';

This article was published on Beijing website production Company Shangpin China //ihucc.com/


Please contact our consultant

+86 10-60259772

Please provide your contact number. The project manager of shangpin China will contact you as soon as possible.