If you thought that the wp-config file was just that thing that WordPress created for you when you first installed WordPress. Well er, you’d be right but it can do so much more…
Below you will find some useful things you can do to help improve your WordPress website by simply adding a single line of code to your wp-config file. All you need is FTP access to the wp-config file and a text editor.
As standard, WordPress will save endless post revisions so the idea being that if you make any changes to a blog post or page and later decide you don’t like it, or want to revert back to a previous version. All is not lost as there are numerous backups ready to restore.
However, for some of us this can become a little annoying, seeing almost limitless post revisions on each post screen. So here are a few useful edits you may want to use to take control;
X being the number of revisions you want WordPress to store before deleting the older ones. So for example you may choose to have 10, but this can be any number you like;
As standard, WordPress saves these auto-backups every 60 seconds. You may think this is a little too often, or not often enough. Either way to change the default save times, you simply need to add the following;
As before, X is whatever figure you want to add. The number is in seconds, so if you wanted to change this to every 2 minutes, you would add the following;
The thing is, there are some people who just hate the feature entirely and would like to see the back of it. Don’t worry, that’s possible too;
WordPress Trash / Bin
If you’re American or have the US language version of WordPress installed, you’ll know this feature as the Trash, but for us Brits and those who have installed the UK language version. You’ll know this as the Bin.
By default, WordPress will empty your Trash / Bin after 30 days, but you may want to change this and have it empty it a little sooner or a little later. To do this, you simply need to add the following;
As before, you need to exit X with the number of days WordPress should wait to automatically empty the Trash / Bin.
If you’d rather disable this feature and have your old posts and pages deleted with a single click with no chance of re-enabling them. You can simply add the following;
define(‘EMPTY_TRASH_DAYS’, 0 );
Be-aware that this will mean that if you accidently delete anything and change your mind. It will be gone for good so be careful using this feature!
Increase WordPress Memory Limit
There may well come a time when you find that a plugin you’re using is running out of memory and giving you errors. However, rather than go and message your web host to increase the memory. You can do it yourself with the following line;
You can add any figure here, but be careful not to increase this by too much as you may find that your web host will not be best impressed if you increase it by too much. Most plugins will not require more that ‘256M’, so consider this to be the limit.
Disable the Plugin and Theme Editor
If you’re making websites for clients or maybe you have other people working on your website and want to ensure they don’t go doing anything they shouldn’t. By this I mean editing the Plugins and Themes, you can disable this by adding the following;
define( ‘DISALLOW_FILE_EDIT’, true );
Be careful though to check all of your plugins are functioning correctly after making this change.
Disable Plugin and Theme Installation and Updates
Another options which will have the same desired effect in that it will allow you to prevent the installations and updating of themes and plugins is to use the following;
define( ‘DISALLOW_FILE_MODS’, true );
Disable WordPress Auto Updates
WordPress switched to auto updates in one of the recent editions of WordPress in the hope of helping site owners to keep on top of the many updates. Whilst this is a great feature in reality because it helps those who may have dozens of websites to ensure they get the latest updates. It does mean that for some, it has the potential to break plugins and themes if they are not compatible with new versions.
As so, there is a way to disable auto updates with the following;
define( ‘AUTOMATIC_UPDATER_DISABLED’, true );
Disable WordPress Core Updates
Another option available to you is to disable all WordPress core updates. This can be achieved with the following;
define( ‘WP_AUTO_UPDATE_CORE’, false );
By default, WordPress only installs minor releases for you, but if you’re particularly security conscious and you want ALL updates regardless of whether they are minor or major updates, you can add the following;
define( ‘WP_AUTO_UPDATE_CORE’, true );
Beware though, that by adding this you will have no way of testing updates with your current setup and could potentially end up with a broken website. So be certain that you know what you’re doing before adding this.
No matter whether you choose to add one, some or all of these edits to your wp-config file. You should make a backup of the original file or make it easy to remove any of these additions should you run into any issues.