WP Elite

Wordpress, web design and SEO tips

Customize your Auto-save and Post Revision feature on your WordPress blog

If you’re not aware of this, WordPress comes with an auto-save and post revision feature using AJAX request that secure your post while you are writing your blog post. This is very useful for bloggers that write their blog on the road using a 3G network, wireless connection or even bloggers that have a poor internet connection. Today I will teach you how to customize your WordPress auto-save and post revision. You can even turn off this feature if you think you don’t need it.

Auto-save:

function disable_autosave() {
wp_deregister_script('autosave');
}
add_action( 'wp_print_scripts', 'disable_autosave' );

Maybe some of you want to disable auto-save feature on your WordPress blog. Just add this script to your functions.php to disable it completely.

define('AUTOSAVE_INTERVAL', 300 ); // seconds

Placing this line of code in your wp-config.php your WordPress blog will auto-save every 5 minutes. The default WordPress auto-save timer is 1 minute. If you like to turn it semi-off, we can place a larger integer so that it will have a longer interval when auto-saving it.

Post Revision:

define('WP_POST_REVISIONS', false );

Another useful code to use if you want to disable the Post revision on your WordPress blog, just placing this on your wp-config.php just like the first example. The benefit of disabling the Post revision is to save some spaces on your MySQL Database, especially if you have lots of blog post.

define('WP_POST_REVISIONS', 2);

If you think disabling it is be a bad idea for your blog, you can also limit the number of Post revision so that it will just take some spaces on your Database. Making it 2 instead of off will limit all your Post revision to 2 revisions per post.

If you’re not comfortable editing your wp-config.php, you can also paste this in your functions.php, but i really recommend using this in your wp-config.php.

That’s it! You just customized your WordPress Auto-save and Post Revision.

Filed Under: Blog

Copyright © 2023 · WPLeet.com