Editor: Use `wp_add_inline_script()` instead of `wp_localize_script()` to pass the `_wpMetaBoxUrl` value to the `wp-editor` script.
This fixes a PHP 8 "Only the first byte will be assigned to the string offset" warning on Edit Post screen. The correct usage of `wp_localize_script()` is to pass an array of data, not a string. Fixes #51108. Built from https://develop.svn.wordpress.org/trunk@48841 git-svn-id: http://core.svn.wordpress.org/trunk@48603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5918f7e11d
commit
23b4fd4a86
|
@ -125,7 +125,11 @@ $meta_box_url = add_query_arg(
|
|||
),
|
||||
$meta_box_url
|
||||
);
|
||||
wp_localize_script( 'wp-editor', '_wpMetaBoxUrl', $meta_box_url );
|
||||
wp_add_inline_script(
|
||||
'wp-editor',
|
||||
sprintf( 'var _wpMetaBoxUrl = %s;', wp_json_encode( $meta_box_url ) ),
|
||||
'before'
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.6-alpha-48840';
|
||||
$wp_version = '5.6-alpha-48841';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue