How can meta boxes be added to “unknown” custom posts?

I’m running WP multi-site and I’ve created a plugin that adds meta boxes to my page and post.

add_meta_box( 'Intro', __('Intro'), 'sewp_post_intro_meta_box', 'post', 'normal', 'high' );
add_meta_box( 'Intro', __('Intro'), 'sewp_post_intro_meta_box', 'page', 'normal', 'high' );

The problem is that this isn’t added for my custom post types. Adding another add_meta_box in my plugin isn’t an option since it will only be relevant for this customer.

Is there a way to get around this?

Solutions Collecting From Web of "How can meta boxes be added to “unknown” custom posts?"

I’m not sure what you mean by “unknown custom posts”, but here is how you’d add a meta box to a number of post types:

$post_types = array(
foreach ($post_types as $post_type)
    add_meta_box('Intro', __('Intro'), 'my_meta_box', $post_type, 'normal', 'high');

If you would like to have different contexts and/or priorities, you have to do it in multiple calls.

If I misunderstood you, please enlighten me.

// Edit
Of course, you could do it the other way around, and exclude post types that you do not want to have this meta box.

$args = array(
    'public' => true,
if (! is_array($post_types = get_post_types($args)))
    $post_types = array();


if (count($post_types))
    foreach ($post_types as $post_type)
        add_meta_box('Intro', __('Intro'), 'my_meta_box', $post_type, 'normal', 'high');

If this isn’t what you’re looking for either, I’m afraid I have no idea what you would be satisfied with.

You don’t want to specify post types, but want some functionality bound to specific post types…

You can try NULL or an empty string as the $screen input value:

add_meta_box( 'Intro', 
              $screen = '', 

to add the meta box to any “screenable” post type, because then the default is:

 if ( empty( $screen ) )
     $screen = get_current_screen();

ps: If you need some specific post types or better control, you should use what @t f suggested.