Meta boxes: Don't assume that callback args are an array.
While the documentation for add_meta_box() specifices that $callback_args should be an array, this has never been enforced, and we have workarounds in place for when it's passed as something other than an array. Rather than break sites that are passing unexpected data, we can quietly just allow for it, instead. Props johnjamesjacoby, birgire, pento. Merges [43838] to trunk. Fixes #45206. Built from https://develop.svn.wordpress.org/trunk@44174 git-svn-id: http://core.svn.wordpress.org/trunk@44004 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d2782aabc5
commit
20992de206
|
@ -1137,12 +1137,13 @@ function do_meta_boxes( $screen, $context, $object ) {
|
|||
continue;
|
||||
}
|
||||
|
||||
// Don't show boxes in the block editor, if they're just here for back compat.
|
||||
if ( is_array( $box[ 'args' ] ) ) {
|
||||
// If a meta box is just here for back compat, don't show it in the block editor.
|
||||
if ( $screen->is_block_editor() && isset( $box['args']['__back_compat_meta_box'] ) && $box['args']['__back_compat_meta_box'] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Don't show boxes in the block editor that aren't compatible with the block editor.
|
||||
// If a meta box doesn't work in the block editor, don't show it in the block editor.
|
||||
if ( $screen->is_block_editor() && isset( $box['args']['__block_editor_compatible_meta_box'] ) && ! $box['args']['__block_editor_compatible_meta_box'] ) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1154,9 +1155,10 @@ function do_meta_boxes( $screen, $context, $object ) {
|
|||
}
|
||||
|
||||
if ( isset( $box['args']['__back_compat_meta_box'] ) ) {
|
||||
$block_compatible |= (bool) $box['args']['__back_compat_meta_box'];
|
||||
$block_compatible = $block_compatible || (bool) $box['args']['__back_compat_meta_box'];
|
||||
unset( $box['args']['__back_compat_meta_box'] );
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
$hidden_class = in_array( $box['id'], $hidden ) ? ' hide-if-js' : '';
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.1-alpha-44173';
|
||||
$wp_version = '5.1-alpha-44174';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue