The perfect implementation of WordPress ban article revision and automatic saving method, wordpress Auto Save _php Tutorial

Source: Internet
Author: User

The perfect implementation of WordPress banned article revision and automatic saving method, WordPress automatic save


Use WordPress So long has been very annoying WordPress article revision and auto-save function, also used Super switch plugin can prohibit WordPress article revision and auto-save function, but their blog plugin has enough, Had to modify the WordPress main program to achieve the prohibition of article revision and automatic saving function. But this method has a bad place is that every time the WordPress upgrade, you have to change the WordPress source code, it is very troublesome. Today accidentally bumped into the ZWW blog found this non-plug-in without modification of the code to implement the WordPress ban article revision and automatic saving method, share to everyone!

The use of the method is simple, as long as the functions.php in the theme directory to add the appropriate code, the code is as follows:

Copy the Code code as follows:
/* Remove 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 ');
}

Test environment: WordPress 3.1.2, the principle of more than 3.0 support.


WORDPRESS38 Publish article ID discontinuous how to solve

If you are not particularly concerned, even discontinuous is irrelevant, this article for you also not much significance.
First, disable the article revision
The so-called article revision is that you modify the article every time, it will automatically help you save the modified version of the article, professional terminology called version control, so as to ensure that in the case of false modification can restore the previous content, which is very helpful in the maintenance of the wiki document, but as our small blog, Does not seem to be of much use, and this revision occupies an ID in the database, which is one of the problems that causes the article ID to be discontinuous. To disable the article revision, you can add it in the wp-config.php file:

1

Define (' Wp_post_revisions ', false);

Second, delete the article revised version
After disabling the article revision, the database still holds the previously created article revision, which is actually not much use, and the ID, we can delete it. As for how to delete, you can execute the following SQL statement in phpMyAdmin (backup):

12345

DELETE a,b,cfrom wp_posts aleft JOIN wp_term_relationships b on (a.id = b.object_id) left JOIN Wp_postmeta c on (a.id = C.P ost_id) WHERE A.post_type = ' revision ';

Iii. removal of unnecessary attachments
I believe many bloggers will upload/insert some attachments at the same time, like, video, music, etc., these attachments can be seen in the WordPress admin background – Media Library, different media corresponding to different articles. But you should note that these media also occupy the article ID, they and the article are stored in the same database table wp_posts. If you specifically pursue the article's ID must be flawless continuous, please do not upload/insert these media when publishing articles, and please in the WordPress Management background – Media Library, delete the previously uploaded media (note that this action does not just delete records, and will delete your uploaded files), Please re-upload these files with FTP if needed.
Four, disable auto-save
The advantage of auto-saving is that when you edit the article, every little time the system will automatically help you save the edited article, prevent the page suddenly closed, resulting in thousands of words before the crash completely lost. The disadvantage is that each article will have a record automatically saved, also occupy an article ID, is also the reason for the article ID discontinuity, if you do not need this feature, please in the following two files:

12

wp-admin/post-new.phpwp-admin/post.php

Comment out this line:

1

Wp_enqueue_script (' AutoSave ');

V. Rearrange the discontinuous article IDs
The following methods do not support the latest version of WordPress. Complete the above four steps, basically can guarantee that the post ID will be continuous, but the previous published article ID is still a mess, we have to rearrange them to ensure that the ID is continuous. I wrote a PHP script, you can download by the following URL, after downloading with a text editor open, according to the beginning of the instructions to modify the database information, and then upload the php file to your blog space, run to see OK, you can go to phpMyAdmin to view Wp_ The ID in the posts table is not contiguous. Or that sentence, please back up your database before you start. (If you use the Post ID as a fixed link, it will likely change the URL of all articles, will affect the search engine included; If you use a plugin to create a new database table, such as voting plug-ins, etc., there will be problems; If you have created a parent-child relationship page in your blog, running the following script will lose this relationship.) Please use with caution! )... Remaining full text >>

WordPress How to turn off auto Save draft work can?

Simply add the following code to the wp-config.php:
Copy the code code as follows:
Define (' Autosave_interval ', 120); Set auto-save interval in seconds, default 60
Define (' Wp_post_revisions ', false); Disable the article revision feature
Define (' Wp_post_revisions ', 3); //

http://www.bkjia.com/PHPjc/904914.html www.bkjia.com true http://www.bkjia.com/PHPjc/904914.html techarticle the perfect implementation of the WordPress ban article revision and automatic saving method, WordPress automatically save using WordPress so long has been very annoying WordPress article revision and automatic saving features, also used ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.