wordpress basic tips

How to Enable Auto-updates in WordPress

Last Updated on April 24, 2022 by WP Knowledge Hub

Maybe you’ve noticed that sometimes you might get email that your WordPress version has updated to the latest version. This is an notification WordPress sends you when they automatically install a minor version security update that doesn’t require your input.

Your WordPress website will however not automatically update when there is a new major release unless you have specifically asked it to do so.

Not only can you set WordPress to do automatic updates for the big releases, but you can also set your website to update plugins automatically. Let’s go over how you can do this, and whether or not it’s a good idea.

What Are WordPress Automatic Updates?

Since WordPress 3.7 in 2013, the team at WordPress.org have allowed WordPress to automatically install a new minor release to improve security. Keeping WordPress up-to-date is an essential part of preventing hackers and bots from accessing your website. Hackers and people will ill-intents are always on the lookout for vulnerabilities, and will exploit any site that has them. By enabling auto-updates, the WordPress team has made the web a safer place.

They also introduced an option to disable automatic updates in WordPress, but it’s recommended that you keep minor updates enabled.

Major updates and plugins, however, are a different story. Minor WordPress updates come with very minimal risk, but allowing WordPress to handle major version updates and plugins automatically might cause some problems. In some instances, it might break your site.

Why Major Automatic Updates Might be Dangerous

Most minor updates are just small visual tweaks but don’t affect how the core files function, but major updates often make game-changing modifications to the way WordPress fundamentally operates. That means, changes to core files, scripts or PHP functions that might not be compatible with your PHP version, your plugins or other custom functions.

That being said, if your website is a basic blog with minimal plugins, and you know you have the latest version of PHP installed, you might want to take the hassle of regular updates. If this is you, then read on to find out how to make your whole operation automatic.

How to Set Automatic Updates in WordPress

Before you begin, it’s important to make sure you have a backup plan, as in, a method of backing up your website in case something goes wrong. If you’re not sure how to setup back-ups, read this guide.

Option 1 – Using a Plugin

This is the easiest and most basic way of enabling all types of automatic updates in WordPress. What you need to do is install and activate the Easy Updates Manager plugin, then visit the Updates Option to enable it.

Option 2 – Manually Enable Automatic Updates

This is for the more advanced WordPress user, and it requires you to change the wp-config.php core WordPress file in your root directory. You can access this file by logging into your web host’s hosting panel, like cPanel, Plesk or Direct Admin, and using its File Manager. Alternatively, you can use an FTP client like FileZilla or Cyberduck.

Add the following line of code to your site’s wp-config.php file.

define( 'WP_AUTO_UPDATE_CORE', true );

The only problem with this code is that it also enables development or nightly updates, which is like WordPress’ version of beta testing. This might cause your website to update to an unstable version, so you need to add this line of code to the functions.php file as well:

add_filter( 'allow_dev_auto_core_updates', '__return_false' );

Or, you could also avoid that last line of code by simply allowing major updates and nothing else:

define( 'WP_AUTO_UPDATE_CORE', major );

How to Enable Auto-updates for Plugins and Themes

Most WordPress setups will have an option on the Plugins page to simply toggle this on or off next to each individual plugin. It will look something like this:

You can also set WordPress to automatically install all plugin updates by simply adding this code to your theme’s functions.php file:

add_filter( 'auto_update_plugin', '__return_true' );

This will let WordPress know to automaticly update installed plugins when there is an update available.

You can do the same for your theme with this line:

add_filter( 'auto_update_theme', '__return_true' );