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. git-svn-id: https://develop.svn.wordpress.org/trunk@48841 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
0228dd6a5d
commit
2e2ef9e538
@ -125,7 +125,11 @@ $meta_box_url = add_query_arg(
|
|||||||
),
|
),
|
||||||
$meta_box_url
|
$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'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user