Family Encyclopedia >> Electronics

How to disable post revisions in WordPress and reduce database size

Posting reviews is a great feature that WordPress has to offer, but for some users it might not be the best option. For users who have limited database space, or for users who create WordPress as a CMS where they don't need auto-save, you can simply disable the Post Reviews feature in WordPress by following this tutorial. By reducing the size of the database, you can also speed up your site.

Open wp-config.php located in your WordPress root directory and add the following code:

define ('AUTOSAVE_INTERVAL', 300); // segundos definen ('WP_POST_REVISIONS', falso);

This code will disable all future Reviews will be saved and it will also increase the auto save interval from 60 seconds to 300 seconds, meaning your post will auto save every 5 minutes instead of every minute.

The above code will not delete old revisions that are already saved in your database. To remove all previous revisions, you will need to visit PHPMyAdmin and run the following SQL query.

ELIMINAR DE wp_posts WHERE post_type = "revision";

This should disable Post Revisions and remove all previously saved post revisions from your Database.

Disclaimer:We are not suggesting that Post Reviews are a bad option. This tutorial is only for those who find themselves in a situation where they need to reduce the size of their database.