I need to load a meta box for editors to choose the parent post first before editing. But dont see the wide meta box i expect and the normal edit page just loads: This is the code at the begining of wp-admin/post-new.php :
if ( $post_type == 'news' && !isset($_GET['parent_id']) ):
//checking if parent_id exists on querystring
//Give them the news meta box only
add_action('add_meta_boxes', function() { add_meta_box('news-parent', 'Please select the Parent Project for this news:', 'news_attributes_meta_box', 'news', 'normal', 'high');});//add wide meta box
function news_attributes_meta_box($post) {
$parentselectbox = wp_dropdown_pages(array(
'post_type' => 'project',
'name' => 'parent_id',
'show_option_none' => __('(no parent)'),
'sort_column'=> 'menu_order,
post_title',
'echo' => 0
));
if ( ! empty($parentselectbox) ) {
echo $parentselectbox;
} // end empty pages check
};
exit;//stop page load after meta box is loaded
//if chosen, give a move forward link with parent_id on querystring
endif;