Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create Post Field in Meta Box Plugin
<?php
add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
function your_prefix_register_meta_boxes( $meta_boxes ) {
$meta_boxes[] = array (
'title' => 'Related Post',
'id' => 'related-post',
'post_types' => array(
0 => 'post',
),
'context' => 'normal',
'priority' => 'high',
'fields' => array(
array (
'id' => 'related_posts',
'type' => 'post',
'name' => 'Related Posts',
'desc' => 'Choose 3 Related Posts',
'post_type' => array(
0 => 'post',
1 => 'page',
),
'field_type' => 'select_advanced',
'multiple' => true,
'required' => 1,
),
),
);
return $meta_boxes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment