metabox html not updating after publish
-
I have added a simple metabox with a checkbox that corresponds to a meta field.
I have verified with xdebug that after posting, the metabox callback is called and returns the updated html, but for some reason it doesn’t update in the editor.function cabtv_add_post_options() { // 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', 'cabtv_notif_on_post_html_view', $post_type, 'side', 'high' ); } } } add_action('admin_init', 'cabtv_add_post_options'); function cabtv_notif_on_post_html_view($post) { //wp_nonce_field( 'cabtv_notif_metabox', 'cabtv_notif_metabox' ); $checked = cabtv_should_post_send_notification($post); if ( get_post_meta( $post->ID, 'cabtv_notifications_sent', true ) == "1" ) { ?> <div style='padding:10px;'><span style='color:red; font-weight:bold;'>Notifications have already been sent for this post.</span></div> <?php } ?> <input type="hidden" name="cabtv_meta_box_present" value="true"></input> <input type="checkbox" name="cabtv_send_notification" value="true" <?php if ($checked) echo 'checked'; ?>></input> <label> <?php echo esc_attr('Send notification on '.($post->post_status === 'publish' ? 'update' : 'publish') ); ?> </label> <?php }
Any ideas?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘metabox html not updating after publish’ is closed to new replies.