Skip to content

Instantly share code, notes, and snippets.

@kutoi94
Created June 18, 2019 04:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kutoi94/8fc76b3ed8f0ff38b098f95e79a53c44 to your computer and use it in GitHub Desktop.
Save kutoi94/8fc76b3ed8f0ff38b098f95e79a53c44 to your computer and use it in GitHub Desktop.
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