Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/klient.dhosting.pl/geeklab/webninja.codes/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the limit-login-attempts-reloaded domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/klient.dhosting.pl/geeklab/webninja.codes/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the polylang domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/klient.dhosting.pl/geeklab/webninja.codes/public_html/wp-includes/functions.php on line 6114
WordPress Post Revisions: disable, autosave, limit, delete - Webninja

WordPress Post Revisions: disable, autosave, limit, delete

Managing post revisions is crucial for optimizing your WordPress site’s performance and database efficiency. By fine-tuning revision settings, you can streamline your workflow and ensure your database remains clutter-free.

Disable Post Revisions via wp-config.php

To disable post revisions completely, edit the wp-config.php file. Insert the code snippet:

define('WP_POST_REVISIONS', false);

Adjust Autosave Intervals via wp-config.php

To avoid losing work in case of unexpected errors or user mistakes, you can enable interval auto-saving. This feature saves your post drafts at regular intervals, providing a safety net in case of data loss. To enable interval auto-saving, you can add the following code to your wp-config.php file:

define('WP_POST_REVISIONS_INTERVAL', 60);
// Set the interval to 60 seconds

This code enables post revisions and sets the interval to 60 seconds.

Limiting the Number of Post Revisions

If you want to limit the number of revisions created for each post, you can do so by adding the following code to your wp-config.php file:

define('WP_POST_REVISIONS', 3);

Delete All Revisions via PHPMyAdmin:

If you want to delete all revisions from your post revisions via PHPMyAdmin, you can do so by using the following SQL query:

DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type = 'revision' AND post_name LIKE '%revision%');

Effectively managing post revisions in WordPress is essential for maintaining a clean and efficient database. By implementing these techniques, you can optimize your site’s performance and enhance your overall user experience.