Commit 15f7c3cd authored by Jake Spurlock's avatar Jake Spurlock
Browse files

Docs: Correct usage of the dynamic auto_update_{$type} filter.

This ensures that the canonical name of the filter is used in Site Health debug data, as well as on plugin and theme screens, so the developer reference site remains correct.

This brings the changes from [48750] to the 5.5 branch.

Props johnbillion.
Fixes #50868, see [48750].

Built from https://develop.svn.wordpress.org/branches/5.5@48756


git-svn-id: https://core.svn.wordpress.org/branches/5.5@48518 1a063a9b-81f0-0310-95a4-ce76da25c4cd
parent 08e44f61
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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
+12 −8
Original line number Diff line number Diff line
@@ -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;
+4 −2
Original line number Diff line number Diff line
@@ -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;
			}
+6 −2
Original line number Diff line number Diff line
@@ -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' );
+3 −2
Original line number Diff line number Diff line
@@ -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,
Loading