几分钟前,我刚刚升级到WordPress 3.1。然而,我注意到,当您在*主*菜单页下显示帖子类型时,它会覆盖菜单链接的链接。
这是我的register_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 );
这是呼叫
add_menu_page
这将添加到管理菜单的链接。
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: 呼叫
add_submenu_page
是在事实之后添加的,不会改变行为或输出一位。我添加此链接是为了重新添加默认链接,默认情况下,3.0.4在生成的链接标题下添加了该链接
add_menu_page
.