WordPress updates defined vs add_filter?

Skimming through the Core_Upgrader::should_update_to_version() method, it looks like we can override the

 defined( 'WP_AUTO_UPDATE_CORE' )    // true (all), false, minor

check, used to setup the local boolean variables$upgrade_dev, $upgrade_minor and $upgrade_major, with the following filters:

...
apply_filters( 'allow_dev_auto_core_updates',   $upgrade_dev   ) 
...
apply_filters( 'allow_minor_auto_core_updates', $upgrade_minor )
...
apply_filters( 'allow_major_auto_core_updates', $upgrade_major )
...

So these filters have the last word over the WP_AUTO_UPDATE_CORE constant check.

Similarly, the automatic_updater_disabled filter can override the AUTOMATIC_UPDATER_DISABLED constant check.

But note that we can’t override the constant itself.

Leave a Comment