bannerbannerbannerbannerbanner
Jova wiki   tid   Login/Logout

Navigation





Search the wiki
»

PoweredBy

Loading a metabox for the correct post-type

Well, actually there's no point to call add_meta_box multiple times, because at the time when add_meta_box are called, the post type is passed by add_meta_boxes hook. (-amabil-)

Here is an example:
add_action( 'add_meta_boxes', 'my_add_custom_box' );

function my_add_custom_box($postType) {
	$types = array('type1', 'type2', 'type3');
	if(in_array($postType, $types)){
		add_meta_box(
				'myid',
				__( 'Title', 'myplugin_textdomain' ),
				'callback',
				$postType
		);
	}
}

Jova wiki is © Jovall