/**
* Fires after meta boxes have been added.
*
* Fires once for each of the default meta box contexts: normal, advanced, and side.
*
* @since 3.0.0
*
* @param string $post_type Post type of the post.
* @param string $context string Meta box context.
* @param WP_Post $post Post object.
*/
do_action( 'do_meta_boxes', $post_type, 'normal', $post );
I found these in wp-admin/edit-form-advanced.php
and I can't figure out purpose of these actions ( checked for add_action( 'do_meta_boxes' ... ) there is no such actions ).
Documentation says
Fires after meta boxes have been added.
Fires once for each of the default meta box contexts: normal, advanced, and side.
But what's purpose is for these action? When should I use these actions?
NOTE: it's not the same as do_meta_boxes()
function and has nothing common with it!
do_meta_boxes
Can be used to manipulate the previously registered meta boxes but before they are echoed. It fires afteradd_meta_boxes
hook.add_meta_boxes
can be used to manipulate previosly registred meta boxes to... i.e. that there should be some othere reason why they puted these action..add_meta_boxes
- registering of metaboxdo_meta_boxes
- displaying metaboxdo_meta_boxes
hook isn't for displaying meta boxes..do_meta_boxes
function is for displaying meta boxes.. if you try to echo something indo_meta_boxes
hook it will show an errorheaders already sent
.do_meta_boxes
hook fires when meta box have been added but before echoed. You can test it, for example, to remove the "featured image" meta_box from your editor.function test_callback($page, $context, $post){ remove_meta_box( 'postimagediv', $page, $context ); } add_action( 'do_meta_boxes', 'test_callback', 10,3 );