/*
* Sadly we probably cannot add this data directly into editor settings.
*
* Some meta boxes need `admin_head` to fire for meta box registry.
* `admin_head` fires after `admin_enqueue_scripts`, which is where we create
* our editor instance.
*/
$script = 'window._wpLoadBlockEditor.then( function() {
wp.data.dispatch( \'core/edit-post\' ).setAvailableMetaBoxesPerLocation( ' .
wp_json_encode( $meta_boxes_per_location ) . ' );
} );';
wp_add_inline_script( 'wp-edit-post',
$script );
/*
* When `wp-edit-post` is output in the `<head>`, the inline script needs to be manually printed.
* Otherwise, meta boxes will not display because inline scripts for `wp-edit-post`
* will not be printed again after this point.
*/
if ( wp_script_is( 'wp-edit-post', 'done'
) ) { printf( "<script type='text/javascript'>\n%s\n</script>\n",
trim( $script ) );
} /*
* If the 'postcustom' meta box is enabled, then we need to perform
* some extra initialization on it.
*/