⌘ Permalink

Enable Automatic Update for WordPress

Ahmet ALMAZ

Ahmet ALMAZ
4 minutes / 620 words / --- views

One way to keep your WordPress site secure is to keep it and everything in it up to date. Meaning that you have to update the core software which is WordPress and the theme you are using. In my case, it’s GeneratePress. One last thing to update are the plugins you are using and in my case, that’s,well…. that’s a long list for another time.

Instead of checking your WordPress update section all the time anticipating a new update, there’s a way to enable automatic update for WordPress. You just set it once and forget it.

Today, I will tell you How to Enable Automatic Update for WordPress.

As I said before, there are three different things that you always need to keep up to date in order to keep your WordPress site secure. Those things are:

  • Core
  • Theme
  • Plugins

With automatic updates for WordPress enabled the task of keeping an eye on them will be a thing of the past. Your WordPress installation will become self-aware and update everything for you once it’s available.

Below are code snippets that once added to your wp-config.php, it will Enable Automatic Update for WordPress Core, Themes and Plugins.

In order to access your wp-config.php file, you need to download an FTP app 1

After locating your website’s wp-config.php, you can use a text editor to edit and add the code snippet you want to use. 2

# Enable Automatic Update for WordPress core

define('WP_AUTO_UPDATE_Core', true);

Our first code snippet is the main code snippet that will allow us to enable an automatic update for WordPress core and later, add filters to it to enable an automatic update for WordPress genes and plugins.

This will update only automatically major releases of WordPress for example:

WordPress version 4.7 to 4.8

# Enable Automatic Update for WordPress theme

add_filter( 'auto_update_theme', '__return_true' );

In order for this code snippet to work, 2 conditions must be met:

  • The WordPress core code snippet must be added before this one.
  • The theme you’re using must be from the WordPress.org repository.

The second code snippet allows you to enable an automatic update for WordPress themes.

# Enable Automatic Update for WordPress plugins.

add_filter( 'auto_update_plugin', '__return_true' );

In order for this code snippet to work, 1 condition must be met:

*The WordPress core code snippet must be added before this one.

And, last but not least, is a filter to enable an automatic update for WordPress plugins.

# How to Enable Automatic Update for WordPress ONLY for themes and plugins?

define( 'WP_AUTO_UPDATE_Core', false );
add_filter( 'auto_update_plugin', '__return_true' );
add_filter( 'auto_update_theme', '__return_true' );

As you’ve seen from the two filters that I just provided to enable automatic updates for WordPress plugins and themes, you MUST include the first code snippet which forces you to enable automatic update for WordPress Core. But what if you only want to enable automatic update for WordPress plugins and themes?

Well, the answer is simple, just write the same first code snippet but instead of true write false like the example above

# How to Disable Automatic WordPress Updates?

define( 'AUTOMATIC_UPDATER_DISABLED', true );

This code snippet overrides all the previous configuration that you’ve provided in your wp-config.php file.

Let’s say the automatic WordPress updates were already enabled and you want to disable them, all you have to do is write the code snippet above.

# Conclusion:

It’s super important to keep your WordPress site up to date on all three areas- CORE, plugins, and themes. This ensures that your site has the latest security patches, features and it’s ready to defend itself from all known vulnerabilities.

So as a way to make things easier for you, it’s recommended that you enable automatic update for ease of mind especially when you are away with no Internet connection, this will automatically protect your site.

# Footnotes

  1. I use and recommend FileZilla since it’s Open Source, Free and receive updates constantly.

  2. I use and recommend Atom by Github since it’s Open Source, Free and receive updates constantly.

Subscribe to the newsletter