mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Scripts: Fix a PHP error in admin-ajax calls.
When making an ajax request, `wp_enqueue_registered_block_scripts_and_styles()` checked if `is_admin()` was true before accessing `$current_screen`, rather than checking if `$current_screen` was defined. This is usually fine, execept for in ajax requests. Props ocean90, foreverpinetree, pento. Merges [43893] and [43894] to trunk. Fixes #45302. Built from https://develop.svn.wordpress.org/trunk@44249 git-svn-id: http://core.svn.wordpress.org/trunk@44079 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e8cbdf9405
commit
909cddb3b8
@ -2470,7 +2470,7 @@ function script_concat_settings() {
|
|||||||
function wp_common_block_scripts_and_styles() {
|
function wp_common_block_scripts_and_styles() {
|
||||||
global $current_screen;
|
global $current_screen;
|
||||||
|
|
||||||
if ( is_admin() && ! $current_screen->is_block_editor() ) {
|
if ( is_admin() && ( $current_screen instanceof WP_Screen ) && ! $current_screen->is_block_editor() ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2504,7 +2504,7 @@ function wp_common_block_scripts_and_styles() {
|
|||||||
function wp_enqueue_registered_block_scripts_and_styles() {
|
function wp_enqueue_registered_block_scripts_and_styles() {
|
||||||
global $current_screen;
|
global $current_screen;
|
||||||
|
|
||||||
$is_editor = ( is_admin() && $current_screen->is_block_editor() );
|
$is_editor = ( ( $current_screen instanceof WP_Screen ) && $current_screen->is_block_editor() );
|
||||||
|
|
||||||
$block_registry = WP_Block_Type_Registry::get_instance();
|
$block_registry = WP_Block_Type_Registry::get_instance();
|
||||||
foreach ( $block_registry->get_all_registered() as $block_name => $block_type ) {
|
foreach ( $block_registry->get_all_registered() as $block_name => $block_type ) {
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.1-alpha-44247';
|
$wp_version = '5.1-alpha-44249';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user