As you probably already know, WordPress is a Content Management System (CMS) and as any software, it gets updates every now and then. The same applies to plugins built for WordPress. Software in general is not static. Regardless of how many or how few plugins we have, every now and then our site (even if very static) requires a bit of care.
Why do I need to update?
WordPress and plugins (and themes) are just like software running on your computer or apps on your phone. They require updates which fix bugs or add new features. Without going into too much details, usually newer is better.
How do I know when to update?
Although important, daily life gets in the way and I am sure we can’t go around checking for updates every day. If you do find yourself in the admin, you can see if updates exist as in the image below:
You can see this site has 7 Updates (yikes). This also includes themes, plugins and WordPress itself.
Updating either of these is rather simple.
Update WordPress
As suggested and recommended practically everywhere, a good idea is to make a backup. Always always backup!
So, long story short, as you can see all you need to do is click the button ‘Update Now’ and WordPress will be updated.
The update will now begin and you need to wait until it finishes. Sometimes we need to log back in and occasionally we need to also perform a database update. Again it’s just a butoon.
Remember, WordPress also does automatic updates, however these are only security updates (from 3.9 to 3.9.1, but not to version 4).
Other settings
It is possible to have custom settings and they require you to edit the wp-config.php file. This file is located in the root folder of WordPress.
define(‘AUTOMATIC_UPDATER_DISABLED’, true); // this will deactivate all automatic updates
define(‘WP_AUTO_UPDATE_CORE’, true); // this will enable all automatic updates, including major releases. use with care!!!Use either one or the other.
WP_AUTO_UPDATE_CORE – you can set two values, true or false. The second option is really the default, so unnecessary, but good to be aware of possibilities.
If you don’t want to touch the wp-config.php file, you can apply the same settings via filters:
add_filter('automatic_updater_disabled', '__return_true'); //deactivate automatic updates
You can use other filters, they all accept true or false values.
add_filter('allow_minor_auto_core_updates', '__return_false'); // Deactivate automatic minor / security updates add_filter('allow_major_auto_core_updates', '__return_true'); // Activate automatic updates add_filter('allow_dev_auto_core_updates', '__return_true'); // Activate automatic updates, dev version. Not recommended on production websites
Manually updating WordPress when automatic updates fail
I recommend you do updates automatically, however sometimes depending on server setup and other things, it’s not possible.
So… if we need to do manual updates keep this in mind: all files need be properly updated, an incomplete transfer can leave you with an unusable website.
These are the steps I take (keeping it simple is better).
Before you start, remember, backup backup backup 🙂
- Download the latest version of WordPress. You can do that from wordpress.org or use the link from the Dashboard (there is a button which lets you download the archive). After download, unzip the .zip file.
- Optional: you can delete the wp-includes and wp-admin folders. I don’t bother, just overwrite these folders and files.
DO NOT touch the wp-content folder - I am assuming you are using FTP, but other methods work as well, but not covered here : Upload the files and overwrite all existing ones. Even if you upload wp-content, the already existing files in there that you uploaded, plugins, images etc. won’t be touched.
- Do the same with the files at the root of the wordpress installation / unzipped folder. DO NOT touch wp-config.php.
- Optional, especially when things go wrong, know there is a file called .maintenance created by WordPress during the update. If it goes wrong, that file can stay there, even if you did a manual update afterwards. If you go and delete the file, your site will go off maintenance mode.
- Optional: sometimes your database needs updates. There is a button which says as much, so click that and that’s it.
The above steps are what I normally do if auto-updates are not possible on a setup.
Things can go wrong so be careful the first few times you do this.
Updating themes and plugins
So far you must have noticed the pattern here: everything is dead simple with WordPress.
When you have plugins or theme updates, just go to Dashboard > updates or Themes / Plugins and you cand see available updates.
There is a button called Update Themes or Update plugins
Here’s the proof 🙂
Just like WordPress itself, these updates are also done immediately as we push the button.
While the update runs, we will see a page that feeds us information regarding the update progress.
Automatically updating plugins and themes
If you like to live on the dangerous side, fear not, you can setup your site to do automatic updates for plugins and themes. Maybe not always the best idea, if something goes wrong, your site might become completely unusable.
So… by default the only automatic updates are for WordPress security releases. Just like other settings, these can also be changed from the theme functions.php (each theme has a file functions.php, in which we can add the below code snippets)
add_filter('auto_update_plugin', '__return_true'); // This will activate all automatic plugin updates add_filter('auto_update_theme', '__return_true'); // This will activate all automatic theme updates
That’s how it’s done, we don’t use wp-config.php, with this one better stick to functions.php.
Manually updating plugins or themes
Sometimes we need to do manual updates for plugins or themes, probably because your setup doesn’t allow you do automated ones. In that case you probably can’t update WordPress itself. It’s hard work, but it builds character…
What ever the reason, manual update of plugins or themes is done the same way as the WordPress manual update: overwrite the old files with the new ones.
That’s it.
Oh yes, make sure you backup… before…
Plugins are located in the wp-content/ folder
Some are just single files, most of them are in a directory.
Themes are under wp-content as well, then /themes.
Since we’re all lazy, the lazy man’s way
Maybe should’ve started with this, but good things come to those who wait 🙂
If what you read above makes you uncomfortable and you don’t want to edit settings from functions.php or wp-config.php all by yourself, there is the lazy man’s way.
Just like phones, there’s an app for everything, so we have a plugin called WP Updates Settings. This one allows you to edit settings in the admin.
You don’t want to check for updates, take a look at my friend’s plugin: WP Updates Notifier. Quite good, does what it says it does.
Other nice tools to consider are ManageWP, InfiniteWP, WP Remote, MainWP and then you have Plesk 12 WordPress Toolkit.
To sum up
It’s quite important to have the latest version and hopefully this provided you with the knowledge you need.
If you need my help, please contact me.
If not, good luck 🙂