[wp-trac] [WordPress Trac] #52818: Ordering metaboxes broken in WP 5.7
WordPress Trac
noreply at wordpress.org
Mon Mar 15 12:45:19 UTC 2021
#52818: Ordering metaboxes broken in WP 5.7
--------------------------+-----------------------------
Reporter: terraling | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 5.7
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Post edit screens with metaboxes allow for drag and drop re-ordering.
This worked up to WordPress 5.6.2, but stopped working in WP 5.7, though
it continues to work if you use the Classic Editor to edit posts rather
than the block editor.
When re-ordering the metaboxes, an ajax update with the action 'meta-box-
order' occurs, and this reports a succesful response both in the working
and non-working cases, so it ''appears'' as if updating the metabox order
works.
But, when the page is reloaded, the metaboxes are displayed in an
unchanged order.
For testing you can use the following code to register two dummy
metaboxes:
{{{#!php
<?php
/**
* Add two dummy metaboxes to post edit screens
*/
function xyz_init_meta_boxes(){
add_meta_box(
'metabox_id_1',
__( 'Metabox One', 'textdomain' ),
'xyz_metabox_callback',
'post',
'normal',
'low',
array( 'foo' => 'One' )
);
add_meta_box(
'metabox_id_2',
__( 'Metabox Two', 'textdomain' ),
'xyz_metabox_callback',
'post',
'normal',
'low',
array( 'foo' => 'Two' )
);
}
add_action( 'load-post.php', 'xyz_init_meta_boxes' );
add_action( 'load-post-new.php', 'xyz_init_meta_boxes' );
function xyz_metabox_callback( $post, $metabox ) {
$foo = $metabox['args']['foo'];
echo "<p>Content of metabox $foo</p>";
}
}}}
To reproduce, with WP 5.7 edit a post using the block editor.
Re-order the two metaboxes and update the post.
Reload the page.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52818>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list