Prevent duplicate admin menu items Closes #5380
This commit is contained in:
parent
082f9f647d
commit
d20c0c30c2
|
@ -27,8 +27,9 @@ class WC_Admin_Menus {
|
|||
add_action( 'admin_menu', array( $this, 'settings_menu' ), 50 );
|
||||
add_action( 'admin_menu', array( $this, 'status_menu' ), 60 );
|
||||
|
||||
if ( apply_filters( 'woocommerce_show_addons_page', true ) )
|
||||
if ( apply_filters( 'woocommerce_show_addons_page', true ) ) {
|
||||
add_action( 'admin_menu', array( $this, 'addons_menu' ), 70 );
|
||||
}
|
||||
|
||||
add_action( 'admin_head', array( $this, 'menu_highlight' ) );
|
||||
add_filter( 'menu_order', array( $this, 'menu_order' ) );
|
||||
|
|
|
@ -42,21 +42,27 @@ class WC_Admin_Welcome {
|
|||
* @return void
|
||||
*/
|
||||
public function admin_menus() {
|
||||
if ( empty( $_GET['page'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$welcome_page_name = __( 'About WooCommerce', 'woocommerce' );
|
||||
$welcome_page_title = __( 'Welcome to WooCommerce', 'woocommerce' );
|
||||
|
||||
// About
|
||||
$about = add_dashboard_page( $welcome_page_title, $welcome_page_title, 'manage_options', 'wc-about', array( $this, 'about_screen' ) );
|
||||
|
||||
// Credits
|
||||
$credits = add_dashboard_page( $welcome_page_title, $welcome_page_title, 'manage_options', 'wc-credits', array( $this, 'credits_screen' ) );
|
||||
|
||||
// Credits
|
||||
$translators = add_dashboard_page( $welcome_page_title, $welcome_page_title, 'manage_options', 'wc-translators', array( $this, 'translators_screen' ) );
|
||||
|
||||
add_action( 'admin_print_styles-'. $about, array( $this, 'admin_css' ) );
|
||||
add_action( 'admin_print_styles-'. $credits, array( $this, 'admin_css' ) );
|
||||
add_action( 'admin_print_styles-'. $translators, array( $this, 'admin_css' ) );
|
||||
switch ( $_GET['page'] ) {
|
||||
case 'wc-about' :
|
||||
$page = add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'wc-about', array( $this, 'about_screen' ) );
|
||||
add_action( 'admin_print_styles-'. $page, array( $this, 'admin_css' ) );
|
||||
break;
|
||||
case 'wc-credits' :
|
||||
$page = add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'wc-credits', array( $this, 'credits_screen' ) );
|
||||
add_action( 'admin_print_styles-'. $page, array( $this, 'admin_css' ) );
|
||||
break;
|
||||
case 'wc-translators' :
|
||||
$page = add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'wc-translators', array( $this, 'translators_screen' ) );
|
||||
add_action( 'admin_print_styles-'. $page, array( $this, 'admin_css' ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue