diff --git a/wp-admin/edit-form-blocks.php b/wp-admin/edit-form-blocks.php index e05be4c356..5e7b39d619 100644 --- a/wp-admin/edit-form-blocks.php +++ b/wp-admin/edit-form-blocks.php @@ -28,6 +28,10 @@ $block_editor_context = new WP_Block_Editor_Context( array( 'post' => $post ) ); $current_screen = get_current_screen(); $current_screen->is_block_editor( true ); +// Load block patterns from w.org. +_load_remote_block_patterns(); +_load_remote_featured_patterns(); + // Default to is-fullscreen-mode to avoid jumps in the UI. add_filter( 'admin_body_class', diff --git a/wp-admin/site-editor.php b/wp-admin/site-editor.php index 421ceb4861..cbbf38e7ea 100644 --- a/wp-admin/site-editor.php +++ b/wp-admin/site-editor.php @@ -31,6 +31,10 @@ $parent_file = 'themes.php'; $current_screen = get_current_screen(); $current_screen->is_block_editor( true ); +// Load block patterns from w.org. +_load_remote_block_patterns(); +_load_remote_featured_patterns(); + // Default to is-fullscreen-mode to avoid jumps in the UI. add_filter( 'admin_body_class', diff --git a/wp-includes/block-patterns.php b/wp-includes/block-patterns.php index b1dfaeb403..55c0dd29ba 100644 --- a/wp-includes/block-patterns.php +++ b/wp-includes/block-patterns.php @@ -48,12 +48,17 @@ function _register_core_block_patterns_and_categories() { * Register Core's official patterns from wordpress.org/patterns. * * @since 5.8.0 + * @since 5.9.0 The $current_screen argument was removed. * - * @param WP_Screen $current_screen The screen that the current request was triggered from. + * @param WP_Screen $deprecated Unused. Formerly the screen that the current request was triggered from. */ -function _load_remote_block_patterns( $current_screen ) { - if ( ! $current_screen->is_block_editor ) { - return; +function _load_remote_block_patterns( $deprecated = null ) { + if ( ! empty( $deprecated ) ) { + _deprecated_argument( __FUNCTION__, '5.9.0' ); + $current_screen = $deprecated; + if ( ! $current_screen->is_block_editor ) { + return; + } } $supports_core_patterns = get_theme_support( 'core-block-patterns' ); @@ -88,14 +93,8 @@ function _load_remote_block_patterns( $current_screen ) { * Register `Featured` (category) patterns from wordpress.org/patterns. * * @since 5.9.0 - * - * @param WP_Screen $current_screen The screen that the current request was triggered from. */ -function _load_remote_featured_patterns( $current_screen ) { - if ( ! $current_screen->is_block_editor ) { - return; - } - +function _load_remote_featured_patterns() { $supports_core_patterns = get_theme_support( 'core-block-patterns' ); /** This filter is documented in wp-includes/block-patterns.php */ diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index d9663946d6..20559dd179 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -332,8 +332,6 @@ add_action( 'wp_footer', 'wp_print_footer_scripts', 20 ); add_action( 'template_redirect', 'wp_shortlink_header', 11, 0 ); add_action( 'wp_print_footer_scripts', '_wp_footer_scripts' ); add_action( 'init', '_register_core_block_patterns_and_categories' ); -add_action( 'current_screen', '_load_remote_block_patterns' ); -add_action( 'current_screen', '_load_remote_featured_patterns' ); add_action( 'init', 'check_theme_switched', 99 ); add_action( 'init', array( 'WP_Block_Supports', 'init' ), 22 ); add_action( 'switch_theme', array( 'WP_Theme_JSON_Resolver', 'clean_cached_data' ) ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 75c5bdfea3..8bb6125bd6 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-alpha-52591'; +$wp_version = '6.0-alpha-52593'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.