Upgrade/Install: Introduce a wrapper for the auto_update_{$type} filter checks.

This allows for cleaner checks whether auto-updates are forced for a plugin or theme.

Follow-up to [48750].

Props rebasaurus, garrett-eclipse, SergeyBiryukov.
Fixes #50875.

git-svn-id: https://develop.svn.wordpress.org/trunk@49241 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-10-20 17:37:16 +00:00
parent 310d8eb83d
commit 6b5b87db58
6 changed files with 27 additions and 29 deletions

View File

@@ -716,9 +716,7 @@ function wp_prepare_themes_for_js( $themes = null ) {
);
}
$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 );
$auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, $auto_update_filter_payload );
$prepared_themes[ $slug ] = array(
'id' => $slug,