The wp-config.php file is hands down one of the most important files in your entire installation – without it your WordPress site will not work. With this great power comes a great responsibility to not screw things up or risk breaking your website.
There are a ton of additions and tweaks you can add to your wp-config.php file, there’s a huge article on the WordPress website if you want to read though all of them. There’s a literal ton of options, 98 per cent of which you will never need. There are a few wp-config.php mods that I am constantly turning to Google to find out how to implement though.
Increasing memory allocated to PHP
Everyone who develops WordPress websites will eventually see the dreaded “Fatal Error – Allowed Memory Exhausted” error message. The more plugins you activate, the more features you add and even the complexity of your pages all add to the amount of memory WordPress requires to run. The default memory setting is perfectly fine for a basic website, but as soon as you install Gravity Forms and WooCommerce, your memory requirements grow pretty quickly. I usually set my memory at 128 MB and that is usually more than enough. Note that if the settings on your web server limit PHP to using a lower amount of memory, say 96 MB, this setting will only give you 96 MB of memory, no matter how high you set it using your wp-config.php file.
Increase PHP Memory to 128MB
Disable the Plugin and Theme Editor
One of the first things I do when setting up any WordPress website is to disable the theme and plugin editing interface. Leaving this interface in place allows inexperienced users to really screw things up and it allows hackers free reign to make changes to almost any file in your WordPress install. If I need to make changes to a specific WordPress file I just use FTP. This is much safer for all involved, and will save you a lot of headache if anyone uses the editor for unapproved or nefarious purposes.
Disable File Editor
Sometimes when developing a WordPress website you run into an error that you just can’t figure out. The easiest way to track down the culprit is to enable WordPress’s Debug feature. Setting this option to TRUE will display a stream of errors right at the top of your webpage, allowing you to analyze and solve any issues you are having. Note that the TRUE and FALSE values for the DEBUG feature are not set in apostrophes because they’re boolean values – if you set WP_DEBUG to ‘false’ it will be interpreted as true because it’s a string value rather than a boolean one.
This is just a short list of the most common modifications I make to the wp-config.php file. For the full list please visit the WordPress Codex for an exhaustive (and exhausting) list of all the wp-config.php changes and tweaks that you can make.
Did I miss your favourite wp-config.php tweak? Let us know in the comments and I’ll add it to this post.