I have this code
function add_custom_meta_box() {
add_meta_box(
'custom_meta_box', // $id
'Custom Meta Box', // $title
'show_custom_meta_box', // $callback
'page', // $page
'normal', // $context
'high'); // $priority
}
add_action('add_meta_boxes', 'add_custom_meta_box');
I want to add more post type like page,post,custom_post_type in this code
'page', // $page
How should I rewrite my code?
Define an array of post types, and register the metabox for each one separately:
If your aim is to add all post types, then you can get the array of post types with:
Or add an argument for WP core post types or custom ones:
Use it like this: