Fixed admin menu highlighting (also custom taxes). Closes #993
This commit is contained in:
parent
cee85cb443
commit
b40e072438
|
@ -49,23 +49,23 @@ add_action( 'admin_head', 'woocommerce_admin_menu_highlight' );
|
||||||
function woocommerce_admin_menu_highlight() {
|
function woocommerce_admin_menu_highlight() {
|
||||||
global $parent_file, $submenu_file, $self, $post_type, $taxonomy;
|
global $parent_file, $submenu_file, $self, $post_type, $taxonomy;
|
||||||
|
|
||||||
$to_highlight = array( 'shop_order', 'shop_coupon' );
|
$to_highlight_types = array( 'shop_order', 'shop_coupon' );
|
||||||
|
|
||||||
if ( isset( $post_type ) ) {
|
if ( isset( $post_type ) ) {
|
||||||
if ( in_array( $post_type, $to_highlight ) ) {
|
if ( in_array( $post_type, $to_highlight_types ) ) {
|
||||||
$submenu_file = 'edit.php?post_type=' . $post_type;
|
$submenu_file = 'edit.php?post_type=' . $post_type;
|
||||||
$parent_file = 'woocommerce';
|
$parent_file = 'woocommerce';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( 'product' == $post_type ) {
|
||||||
$screen = get_current_screen();
|
$screen = get_current_screen();
|
||||||
|
|
||||||
$not_replace = array( 'product_shipping_class', 'product_cat', 'product_tag' );
|
if ( $screen->base == 'edit-tags' && 'pa_' == substr( $taxonomy, 0, 3 ) ) {
|
||||||
|
|
||||||
if ( $screen->base == 'edit-tags' && ! in_array( $taxonomy, $not_replace ) ) {
|
|
||||||
$submenu_file = 'woocommerce_attributes';
|
$submenu_file = 'woocommerce_attributes';
|
||||||
$parent_file = 'edit.php?post_type=' . $post_type;
|
$parent_file = 'edit.php?post_type=' . $post_type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue