Pretty common request, have reviewed a lot of documentation but still can't nail it down. My custom post type is "staffmembers" -- I think this is in the ballpark, but was wondering what I have wrong. Thanks in advance.
$options = array();
$post_types = get_post_types( '', 'staffmembers', 'objects' );
foreach ( $post_types as $post_type ) {
$options[$post_type->slug] = $post_type->name;
}
add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
function your_prefix_register_meta_boxes( $meta_boxes ) {
$meta_boxes[] = array (
'id' => 'author',
'title' => 'Author',
'pages' => array (
'post',
),
'context' => 'normal',
'priority' => 'high',
'autosave' => false,
'fields' => array (
array (
'id' => 'select_2',
'name' => 'Select Field',
'type' => 'select',
'placeholder' => 'Select an Item',
'options' => $options,
),
),
'' => '',
);
return $meta_boxes;
}