Categories
Uncategorized

Tweak settings for WordPress Database Optimization and Trash Emptying

Download the wp-config.php file from your server and make the following changes as per your requirement.

Empty Trash Automatically

You can control the number of days before WordPress permanently deletes posts, pages, attachments, and comments, from the trash bin. The default WordPress setting is 30 days.

define( 'EMPTY_TRASH_DAYS', 15 ); // 15 days

To disable trash set the number of days to “0″. Note that WordPress won’t ask for confirmation when someone clicks on “Delete Permanently”.

define( 'EMPTY_TRASH_DAYS', 0 ); // "0" days

Also read: How to modify WordPress Post Revisions & AutoSave settings without plugins

WordPress Database Optimization (Automatic)

You can enable WordPress Database Optimization by adding the following define to your wp-config.php file only when the feature is required

 define( 'WP_ALLOW_REPAIR', true );

The script can be found at {site-name}/wp-admin/maint/repair.php

Note that when this functionality is enabled, the user need not be logged in to access this feature. This is because its main intent is to repair a corrupted database, Users can often not login when the database is corrupt.