Every now and again it is useful to move the order of the meta boxes on the edit post screen. There’s a handy hook for this called do_meta_boxes which is where we are going to fire off our function.

There isn’t a method to change existing boxes, so the general idea is to remove stuff with remove_meta_box() and add it in the right place with add_meta_box().

In this example I’m removing the Featured Image from a custom post type I have created without a text editor window. I then re-add the Featured Image as ‘normal’ positioning and ‘high’ priority. Nice. Finally add the action to fire off the function and off we go.

function nnm_move_meta_box(){
	remove_meta_box( 'postimagediv', 'custom_post_type', 'side' );
	add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', 'custom_post_type', 'normal', 'high');
}
add_action('do_meta_boxes', 'nnm_move_meta_box');

Now the Featured Image appears under the Title like so:

Leave a Reply

Privacy & more..

Cookie Consent Policy