Optimized wp-config.php File

These are settings which I always add to a WordPress “wp-config.php” file. I call these “optimized wp-config settings” because they keep the site somewhat more optimized than the default settings.

Here are my favorite wp-config settings, followed by a description of each one.

define( 'WP_POST_REVISIONS', false ); // Disable revisions that swell up your database
define( 'AUTOSAVE_INTERVAL', 300 ); // Seconds
define( 'WP_CRON_LOCK_TIMEOUT', 3600 ); // Throttle WP "cron"
define( 'EMPTY_TRASH_DAYS', 5 ); // Empty trash every 5 days
define( 'IMAGE_EDIT_OVERWRITE', true );
define( 'DISALLOW_FILE_EDIT', true ); // discourage hackers

These settings go inside the wp-config.php file in the root of a WordPress installation.

Descriptions of each one:

  1. define( 'WP_POST_REVISIONS', false );

    Setting WP_POST_REVISIONS to false disables the saving of every single revision that you make to posts. Saving every single post revision would swell up and bloat your database.

  2. define( 'AUTOSAVE_INTERVAL', 300 );

    I increase the AUTOSAVE_INTERVAL to 240 seconds because the default is 60 seconds. This is how often WordPress is saving your post while you are editing it. (Please note that if you are a journalist or career blogger, you probably do not want to do this! You may even want to decrease it to maybe 30 seconds. Revisions are good for journalists and career bloggers since an automatically saved revision could save you headaches and rewriting if your computer were to crash while you were writing.)

  3. define( 'WP_CRON_LOCK_TIMEOUT', 3600 );

    The WP_CRON_LOCK_TIMEOUT setting lets you sort of throttle the WordPress “cron” system. By default, WP cron does checks every single minute. That is, every 60 seconds. Here I set it to 3600 seconds, which is one hour.

  4. define( 'EMPTY_TRASH_DAYS', 5 );

    The EMPTY_TRASH_DAYS settings lets you tell WordPress when to automatically permanently delete posts, pages, attachments, and comments from the trash. By default, WordPress empties the trash every 30 days. The example below sets EMPTY_TRASH_DAYS to ‘5’ which tell WordPress to empty the trash every 5 days.

  5. define( 'IMAGE_EDIT_OVERWRITE', true );

    Setting IMAGE_EDIT_OVERWRITE to true makes sure that WordPress will delete old copies of images that you create if you edit images in the admin. If you don’t sent the IMAGE_EDIT_OVERWRITE to true, WordPress will store all old copies of image edits even after you restore the original image and no longer need the old edits.

  6. define( 'DISALLOW_FILE_EDIT', true );

    This line is about security rather than optimization. (Users with access to your admin could still install new plugins and themes, so I’m not sure how much security this setting adds.) Setting DISALLOW_FILE_EDIT to “true” will disable the ability to edit theme files and plugin files in the WordPress admin back end. This DISALLOW_FILE_EDIT setting makes your WordPress site somewhat more secure because if someone does hack your WordPress back end, they will not be able to edit plugin or theme files.

See more:

Questions and Comments are Welcome

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this: