Automatic Updates – WordPress Constants

Auto Update Constants

WordPress has several constants in regards to automatic updates. I will go over the various constants and what they are used for. Most of these constants can be placed in wp-config.php. If that is unavailable, you can always create an mu-plugin to place the constants in. Just be sure to check that they are defined first.

AUTOMATIC_UPDATER_DISABLED

The AUTOMATIC_UPDATER_DISABLED constant allows you to blanket disable automatic updates.

For example, this will disable automatic updates for the entire WordPress install:

if ( ! defined( 'AUTOMATIC_UPDATER_DISABLED' ) ) { define( 'AUTOMATIC_UPDATER_DISABLED', true ); }
Code language: PHP (php)

If the constant is set, you are still able to override it via a filter, as defined below:

/** * Filters whether to entirely disable background updates. * * There are more fine-grained filters and controls for selective disabling. * This filter parallels the AUTOMATIC_UPDATER_DISABLED constant in name. * * This also disables update notification emails. That may change in the future. * * @since 3.7.0 * * @param bool $disabled Whether the updater should be disabled. */ return apply_filters( 'automatic_updater_disabled', $disabled );
Code language: PHP (php)

WP_AUTO_UPDATE_CORE

The WP_AUTO_UPDATE_CORE constant allows you to fine-tune how core WordPress updates are handled.

It takes the following values:

  • true (turns on automatic updates for WordPress core)
  • beta (turns on automatic updates for beta releases)
  • rc (turns on automatic updates for Release Candidates)
  • minor (turns on automatic updates for minor releases)
  • false (disables automatic updates for WordPress core)

Passing true will allow automatic updates for your WordPress install. Passing false will do the opposite, which will disable core automatic updates.

The value beta will allow beta automatic updates. The rc value will automatically update to release candidate releases. And minor will only allow automatic updates for minor releases.

DISALLOW_FILE_MODS

Disallowing file modifications can be set to defining DISALLOW_FILE_MODS to false. This will disable any kind of update to your WordPress install, including manual updates.

Usage of this constant is not recommended as it prevents your WordPress install from being updated.

Conclusion

This has been a short entry, but you’ll find that some hosts use these constants to control automatic updates for their users. Up next will be the available filters you can use to control automatic updates.