auto_update_(type)
Filters whether to automatically update core, a plugin, a theme, or a language.
The dynamic portion of the hook name, $type, refers to the type of update being checked.
Possible hook names include:
Since WordPress 3.7, minor and development versions of core, and translations have been auto-updated by default. New installs on WordPress 5.6 or higher will also auto-update major versions by default. Starting in 5.6, older sites can opt-in to major version auto-updates, and auto-updates for plugins and themes.
See the allow_dev_auto_core_updates, allow_minor_auto_core_updates, and allow_major_auto_core_updates filters for a more straightforward way to adjust core updates.
Usage
add_filter( 'auto_update_(type)', 'wp_kama_auto_update_type_filter', 10, 2 ); /** * Function for `auto_update_(type)` filter-hook. * * @param bool|null $update Whether to update. The value of null is internally used to detect whether nothing has hooked into this filter. * @param object $item The update offer. * * @return bool|null */ function wp_kama_auto_update_type_filter( $update, $item ){ // filter... return $update; }
- $update(true|false|null)
- Whether to update. The value of null is internally used to detect whether nothing has hooked into this filter.
- $item(object)
- The update offer.
Changelog
Since 3.7.0 | Introduced. |
Since 5.5.0 | The $update parameter accepts the value of null. |
Where the hook is called
auto_update_(type)
wp-admin/includes/class-wp-automatic-updater.php 268
$update = apply_filters( "auto_update_{$type}", $update, $item );
wp-admin/includes/update.php 1094
return apply_filters( "auto_update_{$type}", $update, $item );