remove_submenu_page not working
-
I have the following code:
add_action( 'admin_menu', 'tcd_remove_admin_menus', 999 ); function tcd_remove_admin_menus() { if ( current_user_can('shop_manager')){ remove_menu_page('edit.php'); remove_menu_page('upload.php'); remove_menu_page('tools.php'); remove_menu_page('edit-comments.php'); remove_menu_page('users.php'); remove_menu_page('yikes-woo-settings'); remove_menu_page('wpseo_workouts'); remove_menu_page('edit.php?post_type=product'); remove_menu_page('edit.php?post_type=page'); remove_menu_page( 'avada' ); remove_menu_page( 'wc-admin&path=/analytics/overview' ); remove_submenu_page('woocommerce', 'wc-admin'); remove_submenu_page('woocommerce-marketing', 'edit_shop_coupons'); } }
and the only line that doesn’t work is remove_submenu_page(‘wc-admin’, ‘edit_shop_coupons’); I’ve tried multiple things but no success…
I am trying to remove a submenu Under Marketing (admin.php?page=wc-admin&path=/marketing) > Coupons (edit.php?post_type=shop_coupon)
Then I added a code to return the submenus array and I got this:
[woocommerce-marketing] => Array ( [0] => Array ( [0] => Overview [1] => view_woocommerce_reports [2] => admin.php?page=wc-admin&path=/marketing [3] => Overview ) [1] => Array ( [0] => Coupons [1] => edit_shop_coupons [2] => edit.php?post_type=shop_coupon [3] => Coupons ) [2] => Array ( [0] => Gift Cards [1] => manage_woocommerce [2] => gc_giftcards [3] => Gift Cards ) [3] => Array ( [0] => Activity [1] => manage_woocommerce [2] => gc_activity [3] => Activity [4] => hide-if-js ) )
How can I remove Array[1] from the menu?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.