Seite wählen

https://www.wpwhitesecurity.com/guide-configuring-wordpress-automatic-updates/

We all know how important it is to keep the WordPress core, plugins, and themes up to date. Failing to do so will leave your website exposed to malicious hacks.

Luckily, since version 3.7 WordPress has automatic background updates. However, by default automatic updates only apply to minor releases. For example from 5.3.1 to 5.3.2.

In this article we will look into how you can configure automatic updates and enable them for WordPress major version updates, plugin and theme updates. We will also see how you can turn off automatic updates. Let’s dive right into WordPress automatic updates.

The different types of automatic WordPress background updates

In WordPress there are four different types of automatic background updates:

  • Core updates (WordPress itself),
  • Plugin updates,
  • Theme updates,
  • Translation file updates.

The core updates consist of the following:

  • Core development updates that are only available to development installations.
  • Minor core updates: these are maintenance and security updates. These are enabled by default.
  • Major core updates: these include new features and functionality. For example when upgrading from 5.3 to 5.4

Configuring and controlling WordPress automatic updates

There are a number of wp-config.php file constants that you can use to configure WordPress automatic updates.

Disabling all WordPress background updates

Set the constant AUTOMATIC_UPDATER_DISABLED to disable all of the WordPress automatic background updates. Below is the line you should add to your WordPress wp-config.php file:

define( 'AUTOMATIC_UPDATER_DISABLED', true );

Controlling WordPress core automatic updates

Use the wp-config.php constant WP_AUTO_UPDATE_CORE to control and specify which core updates you want to have automatically installed. Below are some examples.

Enabling all WordPress core updates

# Enables all core updates (minor, major, dev)
define( 'WP_AUTO_UPDATE_CORE', true );

Enabling only WordPress major core updates

# Enables major version updates only
define( 'WP_AUTO_UPDATE_CORE', major );

Enabling only WordPress minor core updates (default behaviour)

# Enables minor version updates only
define( 'WP_AUTO_UPDATE_CORE', minor );

Disabling all WordPress core updates

# Disables all core updates
define( 'WP_AUTO_UPDATE_CORE', false );

Note: It is not recommended to disable WordPress automatic updates. However you might need to in specific scenarios. For example:

  • the WordPress website files are managed via a version control system,
  • it is a testing or development website,
  • WordPress is customized and is running on multiple servers,
  • You are confident you can push WordPress update in a timely fashion.

Filtering the WordPress automatic updates

When you enable all the WordPress core automatic updates your website will be updated with development (nightly builds), minor and major updates. Use filters to selectively enable or disable any of them, as shown in the below examples.

Filter for automatic development updates (nightly builds)

Add the below filter to your site’s plugin or theme’s functions.php to disable auto updating to WordPress core development updates (nightly builds):

add_filter( 'allow_dev_auto_core_updates', '__return_false' );

Delete the above line to enable again development updates or change ‘__return_false’ to ‘__return_true’.

Filter for minor versions automatic updates

Add the below filter to your site’s plugin or theme’s functions.php to disable auto updating to minor version updates :

add_filter('allow_minor_auto_core_updates', '__return_false' );

Delete the above line to enable again minor version updates or change ‘__return_false’ to ‘__return_true’.

Filter for automatic WordPress major updates

Add the below filter to your site’s plugin or theme’s functions.php to disable auto updating to WordPress major version updates:

add_filter('allow_major_auto_core_updates', '__return_false' );

Delete the above line to enable again major version updates or change ‘__return_false’ to ‘__return_true’.

Configuring WordPress automatic updates for plugins and themes

By default the auto updates for WordPress plugins and themes are disabled. You can use filters in your site’s plugin or functions.php to enable them, as explained below.

Enabling automatic background updates for WordPress plugins

Add the following filter in your site’s plugin or functions.php file to enable automatic WordPress plugins updates:

add_filter( 'auto_update_plugin', '__return_true' );

Change ‘__return_true’ to ‘__return_false’ to specifically disable automatic updates of WordPress plugins.

Enabling automatic background updates for WordPress themes

Add the following filter in your site’s plugin or functions.php file to enable automatic WordPress themes updates:

add_filter( 'auto_update_theme', '__return_true' );

Change ‘__return_true’ to ‘__return_false’ to specifically disable automatic updates of WordPress themes.

Enable WordPress automatic updates and also…

WordPress automatic updates are great. They allow you keep your WordPress core, plugins and themes up to date automatically, thus saving you a lot of time. However, when you enable WordPress automatic background updates  you should also:

The post WordPress automatic updates: understanding and configuring them appeared first on WP White Security.

Source: Security Feed

Share This