Read our latest blog posts, learn something new, find answers, and stay up to date.

Helpful WordPress wp-config.php Settings


wp-config.php – one most important WordPress files, yet often overlooked. There are a number of great configuration gems you can add to your wp-config.php file to help with debugging, performance, and maintenance that I would recommend looking at if you use WordPress (there is surely something for everyone). All settings are documented: in the WordPress Codex but here are some of my favorite.

  • Specify the Number of Post Revisions
    define( 'WP_POST_REVISIONS', 3 );

    The default is set to 5 but a lower number can decrease database clutter.

  • Empty the Trash
    define( 'EMPTY_TRASH_DAYS', 15 ); // 15 days

    The default is set to 30 but if you are looking to make things tidier – you can easily lower the time between deleting items marked as trash.

  • Automatic Database Optimizing
    define( 'WP_ALLOW_REPAIR', true );

    The default is set not to optimize the database – so putting this in the wp-config will enable optimization.

  • Disable the Plugin and Theme Editor
    define( 'DISALLOW_FILE_EDIT', true );

    The default is set to allow editing. Users want the ability to edit theme and plugin files, but developers know better and know it is just a matter of time before save goes bad. Disallow it.

  • Save Queries for Analysis
    define( 'SAVEQUERIES', true );

    The default is not to save queries. As mentioned before in an earlier post this is a great way to debug and optimize WordPress.

  • Redirect Nonexistent Blogs
    define( 'NOBLOGREDIRECT', '' );

    If this is set when using WordPress Multisite – you can set up a redirect for the browser if the visitor tries to access a nonexistent blog so you can better control traffic.

Overall – there are a number of helpful settings available for you to explore by adding a line or two to to the wp-config.php file. It is well worth your time reviewing your site performance, needs, and data every so often to make sure your site’s performance is the best it can be. Take a few minutes to check out all the options available to you!