I just recently upgraded to WordPress 3.1 a few moments ago. However, I noticed that when you have Post Types show up under a *main* menu page, it overrides the link fo th menu link.
Here's my register_post_type
arguments for "Visitor" post type.
$v_args = array(
'labels' => array (
'name' => 'Visitors',
'singular_name' => 'Visitor',
'add_new_item' => 'Register New Visitor', // TODO: http://codex.wordpress.org/Function_Reference/register_post_type#Arguments
),
'public' => true,
'publicly_queryable' => false,
'exclude_from_search' => true,
'show_ui' => true,
'show_in_menu' => 'argus',
//'show_in_menu' => false,
'hiearchical' => false,
'supports' => array( '' ),
'capabilities' => $visitor_caps,
'register_meta_box_cb' => array ( &$this, '_wp_visitor_meta_box_cb' ),
);
// http://codex.wordpress.org/Function_Reference/register_post_type
register_post_type( $post_type, $v_args );
Here is the call to add_menu_page
that adds the link to the admin menu.
public function _wp_admin_menu( )
{
add_menu_page( 'Argus', 'Argus Admin', 'argus', 'argus', array( &$this, '_wp_argus_main_panel' ), '', -1 );
add_submenu_page( 'argus', 'Argus Administration', 'Main Menu', 'argus', 'argus', array( &$this, '_wp_argus_main_panel' ) );
// save having to register 'admin_menu' action across every sub-plugin
// There is no 'admin_menu' function/method in any class stored in $classes
foreach( self::$classes as $class => $obj )
{
if ( method_exists( $obj, 'admin_menu' ) )
{
$obj->admin_menu();
}
}
}
Please note: The call to add_submenu_page
was added after the fact and doesn't change the behavior or output one bit. I added this to re-add the default link that 3.0.4 added by default under the link header generated by add_menu_page
.