WordPress wp-config.php snippets

Adjust WP_Memory_Limit

If you need to adjust your wp_memory_limit, which if you run a lot of plugins or big functions, you may need to.

Be sure to replace 256M with the memory limit that you need, however 256mb is generally plenty for most WordPress websites.

define('WP_MEMORY_LIMIT', '256M');

Automatically Clear Trash After 'X' Amount Of Days

If you want WordPress to automatically clear content from your sites trash.

Be sure to replace the numeric value in this snippet with the number of days you would like to keep pages/posts/products/comments etc in the trash.

define('EMPTY_TRASH_DAYS', 7 );

Disable Auto Update for WordPress Core

You can disable automatic updates of minor versions for your WordPress core.  WordPress never automatically updates the core to a major version regardless of this setting.

define('WP_AUTO_UPDATE_CORE', false);

Disable Front End Admin Bar

You can stop the admin bar from being visible from the front end for logged in users.

add_filter( 'show_admin_bar', '__return_false' );

Limit (Or Disable) Maximum Post Revisions

You can limit the number of page/post revisions stored by WordPress.

define('WP_POST_REVISIONS', 10);

Or to disable them all together.

define('WP_POST_REVISIONS', false);

Set The Autosave Time

You can customise the time between auto saves for your pages/posts, the numeric value here is in seconds, so for 10 minutes, set the time to 600, for 2 minutes you would set it to 120 etc.

define('AUTOSAVE_INTERVAL', 600);