The 4th parameter for add_meta_box()
is the post_type
. So if you’re calling it with post
, it’ll only show on WordPress’s native posts.
Try this:
add_meta_box(
'my-meta-box-id2',
'Enter your PDF location for your post category below:',
'cd2_meta_box_cb',
'your_custom_post_type_name',
'normal',
'high'
);
If you have multiple post types you’d like to attach this to, this should work:
$post_types = array( 'post_type_1', 'post_type_2', ); // and so forth
foreach( $post_types as $post_type) {
add_meta_box(
'my-meta-box-id2',
'Enter your PDF location for your post category below:',
'cd2_meta_box_cb',
$post_type,
'normal',
'high'
);
}
(Whoops — fixed the code to actually use the $post_type
variable.)