Action hook on Edit custom post type?

register_post_type() has a registration option called 'register_meta_box_cb'. Set that to a valid callback and it will call that function only when it is compiling the meta boxes for that post type’s edit screen. Something like this:

register_post_type( 'foo', array(
  'public' => true,
  'label' => 'foo',
  'register_meta_box_cb' => 'bar',
));

function bar(){
  add_meta_box('blah', 'blah', /* etc */ );
}

Leave a Comment