I have a custom post type which have a lot of custom field that categories in meta box. The problem is how do I sorting the meta box in the order that I desired?

As I know there is only 'high','core','normal' and 'side' for positioning the meta box, which is not a practical way to sorting the meta box. Let's say if I set 'high' position for two meta boxes, how do I know which one is on the top??



2 Answers 2


In the following example, replace CPT with the post type name, like post, page, book, event, imaginary, foobar...

add_filter( 'get_user_option_meta-box-order_CPT', 'metabox_order' );
function metabox_order( $order ) {
    return array(
        'normal' => join( 
            array(       // vvv  Arrange here as you desire

Users can drag and drop meta boxes and WordPress will save the order. So, in a sense, the order in which they were originally rendered does not matter.

You know which one comes first because when you call add_meta_box it simply pushes your meta box's args onto a global array called $wp_meta_boxes. Whichever call to add_meta_box came first will be the first meta box.

  • I know, but I want the position to be fixed. I don't want to allow the user to change the position. Is there anyway to predefined the position by the admin, and then fixed it so the user cannot change it?
    – dev-jim
    Commented Jul 9, 2012 at 13:24
  • Why is your meta box that important? Commented Jul 9, 2012 at 13:54
  • 6
    Well, I just want better user experience.
    – dev-jim
    Commented Jul 9, 2012 at 15:41
  • @dev-jim can you solve this questions, I want to the same functionality. best
    – xzegga
    Commented Nov 9, 2015 at 8:19
  • Maybe disabling the ability to drag it around is bad UX. Yet, what about redefining the order they are added at? Perhaps the CPT has a register_meta_box_cb in the register_post_type which will regard that metabox as first, but it would be nice to make sure that a later-added metabox can still display first by default. Commented Feb 3, 2017 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.