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??
Thanks
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 toadd_meta_box
came first will be the first meta box.In the following example, replace CPT with the post type name, like post, page, book, event, imaginary, foobar…