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.

I just figured out the menu_position parameter it seems like you can place the menu of your custom post type almost everywhere. Except above the Posts menu!

How can I accomplish that?

share|improve this question
    
Good question, it seems that is the one place it won't go. –  jnthnclrk Aug 29 '13 at 12:44

6 Answers 6

The new JetPack Plugin places its menu link immediately below the Dashboard link. It does so by setting its menu order to 0, by filtering the $menu_order array:

function jetpack_menu_order( $menu_order ) {
        $jp_menu_order = array();

        foreach ( $menu_order as $index => $item ) {
            if ( $item != 'jetpack' )
                $jp_menu_order[] = $item;

            if ( $index == 0 )
                $jp_menu_order[] = 'jetpack';
        }

        return $jp_menu_order;
    }

Out of curiosity, what would happen if you tried 0 as menu_position?

share|improve this answer

This is a bug in WordPress. Please see this thread in Trac: http://core.trac.wordpress.org/ticket/14755

share|improve this answer

Positions for Core Menu Items

  • 2 Dashboard
  • 4 Separator
  • 5 Posts
  • 10 Media
  • 15 Links
  • 20 Pages
  • 25 Comments
  • 59 Separator
  • 60 Appearance
  • 65 Plugins
  • 70 Users
  • 75 Tools
  • 80 Settings
  • 99 Separator

Parameter description for "menu position"

$position (integer) (optional) The position in the menu order this menu should appear. By default, if this parameter is omitted, the menu will appear at the bottom of the menu structure. The higher the number, the lower its position in the menu.

WARNING: if two menu items use the same position attribute, one of the items may be overwritten so that only one item displays! Risk of conflict can be reduced by using decimal instead of integer values, e.g. 63.3 instead of 63.

Default: bottom of menu structure

share|improve this answer

I've used 'menu_postion' => 0, 1,2,3,4.

Doesn't matter really. If you play around with it you can easily figure it out.

Using 'menu_position' => 1 should place it below the Dashboard menu item above the separator thing. 0 Should place it above the Dashboard

share|improve this answer

You can use this:

function my_move_post () {
    global $menu;
    $menu[6] = $menu[5]; //move post from post 5 to 6
    unset($menu[5]); //free the position 5 so you can use it!
}
add_action('admin_menu', 'my_move_post');

Now you can use position 5 to add you menu above Post menu.

share|improve this answer

On the same link you linked, it reads:

menu_position
(integer) (optional) The position in the menu order the post type should appear.
Default: null - defaults to below Comments
5 - below Posts
10 - below Media
20 - below Pages
60 - below first separator
100 - below second separator

So, if you set menu_position to something like 4, then it should put it above posts.

A position of -1 puts it above the Dashboard link.

share|improve this answer
    
I tried 4 but it exactly the same as 5. –  janoChen Feb 7 '11 at 19:23
    
Hrm. Tried 1-3? I think perhaps "1" (or "0") is the Dashboard. Perhaps something 2-3 would work –  Zack Feb 7 '11 at 20:32
    
0 1 2 3 Goes before the Dashboard and 4 Goes below Posts. Is really impossible! –  janoChen Feb 8 '11 at 5:44
    
Wow. broken much WordPress? I don't know then. :-/ –  Zack Feb 8 '11 at 5:52
    
I think that 4 is the separator right above Posts, and 5 is Posts, so if you set your menu-position to 3 it will be right before the separator. With default configuration of course. Setting my plugin page to 4 overwrote the separator, but did appear just above Posts. hmmm... –  goldenapples Mar 28 '11 at 19:50

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.