Make WordPress Core

Opened 3 years ago

Last modified 8 months ago

#53620 new defect (bug)

add_meta_box $callback firing after publish or update but not updating dom html

Reported by: hedgehog90's profile hedgehog90 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.7.1
Component: Editor Keywords: reporter-feedback
Focuses: Cc:


Basically, the callback in add_meta_box is firing after I update my post (got the spinning circle in the meta box header), returning new updated html, but the new html is not applied to the actual page.

The following metabox just renders a random number:

add_action('admin_init', function () {
        // Add our meta box for the "post" post type (default)
        if ( current_user_can("send_notifications") ) {
                $post_types = ["post", "go_live"];
                foreach ($post_types  as $post_type) {
                                function ($post) {
                                        echo rand();

After the post is published / updated, the metabox should regenerate and a new random number should display... presumably... otherwise why is it called?

I notice the entire wp-admin/post.php page is downloaded in the developer tools network tab after updating the post, and if I inspect the response I can see that the random number is different, however the original page remains the same.

Change History (2)

#1 in reply to: ↑ description @hedgehog90
3 years ago

I should say I'm not 100% sure if it's supposed to update the meta box html after updating the post, but I would assume so by the fact that that the spinner appears in the meta box header and only disappears once the html response from post.php is sent... and if not, I would appreciate someone telling me the correct way to update the meta box without reloading the page.

#2 @desrosj
8 months ago

  • Component changed from General to Editor
  • Keywords reporter-feedback added

Hi @hedgehog90!

Apologies that it took so long to receive a response here.

Could you clarify whether you are seeing this behavior in the block editor or the Classic Editor?

Note: See TracTickets for help on using tickets.