Seriously stuck with some custom meta box/plugin stuff

Here is a simple example that adds a meta box to all public post types:

// All public post types
$post_types = array_merge(
    array('page' => 'page', 'post' => 'post'),
    get_post_types(array('_builtin' => FALSE)),
);

// Add meta box for each post type
foreach ($post_types as $post_type)
{
    add_meta_box('id', 'title', 'callback', $post_type);
}

WP Codex: get_post_types(), add_meta_box().

Leave a Comment