diff --git a/src/wp-admin/includes/class-wp-automatic-updater.php b/src/wp-admin/includes/class-wp-automatic-updater.php index 0862e29984..4cf2b0b75b 100644 --- a/src/wp-admin/includes/class-wp-automatic-updater.php +++ b/src/wp-admin/includes/class-wp-automatic-updater.php @@ -179,7 +179,12 @@ class WP_Automatic_Updater { * 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. Can be 'core', 'theme', 'plugin', or 'translation'. + * being checked. Potential hook names include: + * + * - `auto_update_core` + * - `auto_update_plugin` + * - `auto_update_theme` + * - `auto_update_translation` * * Generally speaking, plugins, themes, and major core versions are not updated * by default, while translations and minor and development versions for core diff --git a/src/wp-admin/includes/class-wp-debug-data.php b/src/wp-admin/includes/class-wp-debug-data.php index 3f9d9cd659..503dc7bfe8 100644 --- a/src/wp-admin/includes/class-wp-debug-data.php +++ b/src/wp-admin/includes/class-wp-debug-data.php @@ -971,8 +971,9 @@ class WP_Debug_Data { $item = array_merge( $item, array_intersect_key( $plugin, $item ) ); } - /** This action is documented in wp-admin/includes/class-wp-automatic-updater.php */ - $auto_update_forced = apply_filters( 'auto_update_plugin', null, (object) $item ); + $type = 'plugin'; + /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */ + $auto_update_forced = apply_filters( "auto_update_{$type}", null, (object) $item ); if ( ! is_null( $auto_update_forced ) ) { $enabled = $auto_update_forced; @@ -1114,8 +1115,9 @@ class WP_Debug_Data { ); } - /** This action is documented in wp-admin/includes/class-wp-automatic-updater.php */ - $auto_update_forced = apply_filters( 'auto_update_theme', null, (object) $item ); + $type = 'theme'; + /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */ + $auto_update_forced = apply_filters( "auto_update_{$type}", null, (object) $item ); if ( ! is_null( $auto_update_forced ) ) { $enabled = $auto_update_forced; @@ -1201,8 +1203,9 @@ class WP_Debug_Data { ); } - /** This action is documented in wp-admin/includes/class-wp-automatic-updater.php */ - $auto_update_forced = apply_filters( 'auto_update_theme', null, (object) $item ); + $type = 'theme'; + /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */ + $auto_update_forced = apply_filters( "auto_update_{$type}", null, (object) $item ); if ( ! is_null( $auto_update_forced ) ) { $enabled = $auto_update_forced; @@ -1290,8 +1293,9 @@ class WP_Debug_Data { ); } - /** This action is documented in wp-admin/includes/class-wp-automatic-updater.php */ - $auto_update_forced = apply_filters( 'auto_update_theme', null, (object) $item ); + $type = 'theme'; + /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */ + $auto_update_forced = apply_filters( "auto_update_{$type}", null, (object) $item ); if ( ! is_null( $auto_update_forced ) ) { $enabled = $auto_update_forced; diff --git a/src/wp-admin/includes/class-wp-plugins-list-table.php b/src/wp-admin/includes/class-wp-plugins-list-table.php index ff7a90b222..40223b6d47 100644 --- a/src/wp-admin/includes/class-wp-plugins-list-table.php +++ b/src/wp-admin/includes/class-wp-plugins-list-table.php @@ -231,8 +231,10 @@ class WP_Plugins_List_Table extends WP_List_Table { ); $filter_payload = (object) array_merge( $filter_payload, array_intersect_key( $plugin_data, $filter_payload ) ); - /** This action is documented in wp-admin/includes/class-wp-automatic-updater.php */ - $auto_update_forced = apply_filters( 'auto_update_plugin', null, $filter_payload ); + $type = 'plugin'; + /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */ + $auto_update_forced = apply_filters( "auto_update_{$type}", null, $filter_payload ); + if ( ! is_null( $auto_update_forced ) ) { $plugin_data['auto-update-forced'] = $auto_update_forced; } diff --git a/src/wp-admin/includes/class-wp-site-health.php b/src/wp-admin/includes/class-wp-site-health.php index b3faee728c..c27a50a2ef 100644 --- a/src/wp-admin/includes/class-wp-site-health.php +++ b/src/wp-admin/includes/class-wp-site-health.php @@ -2372,10 +2372,14 @@ class WP_Site_Health { 'requires_php' => '5.6.20', ); + $type = 'plugin'; /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */ - $test_plugins_enabled = apply_filters( 'auto_update_plugin', true, $mock_plugin ); + $test_plugins_enabled = apply_filters( "auto_update_{$type}", true, $mock_plugin ); + + $type = 'theme'; /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */ - $test_themes_enabled = apply_filters( 'auto_update_theme', true, $mock_theme ); + $test_themes_enabled = apply_filters( "auto_update_{$type}", true, $mock_theme ); + $ui_enabled_for_plugins = wp_is_auto_update_enabled_for_type( 'plugin' ); $ui_enabled_for_themes = wp_is_auto_update_enabled_for_type( 'theme' ); $plugin_filter_present = has_filter( 'auto_update_plugin' ); diff --git a/src/wp-admin/includes/theme.php b/src/wp-admin/includes/theme.php index 67d557096c..21730339cd 100644 --- a/src/wp-admin/includes/theme.php +++ b/src/wp-admin/includes/theme.php @@ -716,8 +716,9 @@ function wp_prepare_themes_for_js( $themes = null ) { ); } - /** This action is documented in wp-admin/includes/class-wp-automatic-updater.php */ - $auto_update_forced = apply_filters( 'auto_update_theme', null, $auto_update_filter_payload ); + $type = 'theme'; + /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */ + $auto_update_forced = apply_filters( "auto_update_{$type}", null, $auto_update_filter_payload ); $prepared_themes[ $slug ] = array( 'id' => $slug,