[wp-trac] [WordPress Trac] #53620: add_meta_box $callback firing after publish or update but not updating dom html
WordPress Trac
noreply at wordpress.org
Wed Jul 7 15:02:56 UTC 2021
#53620: add_meta_box $callback firing after publish or update but not updating dom
html
--------------------------+-----------------------------
Reporter: hedgehog90 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 5.7.1
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
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:
{{{#!php
<?php
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) {
add_meta_box(
'cabtv_notif_on_post',
'Notifications',
function ($post) {
echo rand();
},
$post_type,
'side',
'high'
);
}
}
});
}}}
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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53620>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list