One metabox for multiple post types

Define an array of post types, and register the metabox for each one separately:

function add_custom_meta_box() {

    $post_types = array ( 'post', 'page', 'event' );

    foreach( $post_types as $post_type )
    {
        add_meta_box(
            'custom_meta_box', // $id
            'Custom Meta Box', // $title 
            'show_custom_meta_box', // $callback
             $post_type,
            'normal', // $context
            'high' // $priority
        );
    }
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)