mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
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. Fixes #45206. git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43838 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
96857764e1
commit
cdb35577d2
@ -1052,12 +1052,13 @@ function do_meta_boxes( $screen, $context, $object ) {
|
||||
if ( false == $box || ! $box['title'] )
|
||||
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;
|
||||
}
|
||||
@ -1069,9 +1070,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' : '';
|
||||
|
Loading…
x
Reference in New Issue
Block a user