Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How would you make a meta box sit above all other meta boxes at all times in a custom post type?

For example:

add_meta_box ( 
    'aisis-meta-id', 
    'Mini Feeds Information', 
    array(&$this, 'aisis_mini_feeds_info'), 
    'mini-feed', 
    'advanced', 
    'high' 
);

Create a meta box, how ever it only appears after ALL other meta boxes, be they plugin or system wide. I need my meta box to sit directly under the editor at all times.

share|improve this question
    
For one, 'normal' takes precedence over 'advanced'. –  Johannes Pille Apr 7 '13 at 21:48
    
it was normal before, I switched it to advanced thinking it would be the opposite of what you said. Even as normal it appears UNDER the rest of the meta boxes. @JohannesPille - But ill switch it back. –  TheWebs Apr 7 '13 at 21:50
    
That's why I commented and didn't answer. Certainly ain't a complete solution. But it's true, nonetheless. If you care, try to add 2 metaboxes, give one 'advanced' and the other 'normal'. Observe their order. –  Johannes Pille Apr 7 '13 at 21:54
add comment

1 Answer

up vote 4 down vote accepted

Change advanced to normal, this will at least move it up above some others.

However, there's no guarantee you get the top spot, because a user can still drag and drop metaboxes around, or a core metabox or one added by another plugin might believe it is more important than yours.

There's no way for WordPress could offer the top spot as an option, as what would happen when two plugins decided they both wanted it?

p.s. here's how to move Yoast's SEO plugin metabox down:

add_filter( 'wpseo_metabox_prio', 'move_yoast_metabox_down' );

function move_yoast_metabox_down( $priority ) {
    return 'low';
}
share|improve this answer
    
Well the whole reason for this was because some plugins I have used or currently use, like yoast seo, add their meta box as always number one, my meta box is then number 2....when I need it to be number one. –  TheWebs Apr 7 '13 at 22:01
1  
Yoast's SEO plugin provides a filter called wpseo_metabox_prio that allows you to change its priority –  Simon Blackbourn Apr 7 '13 at 22:08
1  
I've just added some code to my answer to show how to use this. –  Simon Blackbourn Apr 7 '13 at 22:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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