MetaBox body is not showing (the callback function)

That global_box_meta_box_callback() is a class method (i.e. a function inside a class) and not a globally defined function, so you need to use [ $this, ‘global_box_meta_box_callback’ ] (or array( $this, ‘global_box_meta_box_callback’ )) when supplying the class method to add_meta_box(): class Foo { … function wpd_add_meta_box() { $screens = get_post_types(); foreach ( $screens as $screen ) … Read more

Plugin – Combine Meta Box Input Fields into single saveble record

Use something like this after you foreach loop. In this example link is saved in new meta field. You can overwrite document_overview_document-link, but then you will get combined html code as link value when open your document in editor. foreach { … } if ( isset( $_POST[ ‘document-link’ ] ) ) { $html=”<a class=”btn btn-outline-info … Read more

Custom Field created in add_meta_boxes reappearing itself again in the default Custom Metabox

Prepending your metakey with an underscore _ makes it private and prevents the data from showing up in the default metabox. So instead of this, update_post_meta( $post_id,’product_desc_en’, wp_kses_post( $_POST[‘product_desc_en’] ) ); do this, update_post_meta( $post_id,’_product_desc_en’, wp_kses_post( $_POST[‘product_desc_en’] ) ); and your custom meta shouldn’t show up in the default metabox. P.s. And of course, when … Read more

Meta box html is not updating after saving

snippet code of notification display when check notify checkbox and display message in Update and Publish post or page in admin function cabtv_add_post_options() { // Add our meta box for the “post” post type (default) $post_types = array(“post”, “page”); 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(‘add_meta_boxes’, ‘cabtv_add_post_options’); function cabtv_notif_on_post_html_view($post) { wp_nonce_field( ‘cabtv_notif_metabox’, ‘cabtv_notif_metabox’ … Read more