Title: Menu Issue with another plugin
Last modified: February 6, 2021

---

# Menu Issue with another plugin

 *  Resolved [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/menu-issue-with-another-plugin/)
 * Hello, found an issue with the URL of a menu of another well-established plugin
   not getting rendered correctly when AME is active. Please refer to [this issue](https://wordpress.org/support/topic/stripe-gateway-link-returns-404),
   thanks.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Janis Elsts](https://wordpress.org/support/users/whiteshadow/)
 * (@whiteshadow)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/menu-issue-with-another-plugin/#post-14011716)
 * Thank you for the report. It looks like this is another annoying case where a
   plugin removes a menu item using the `admin_head` action instead of the `admin_menu`
   action. Because Admin Menu Editor has already finished processing the admin menu
   by that time (it has to do that to properly apply menu permissions), it doesn’t“
   see” the removal and the item remains in the admin menu.
 * In this case, that item happens to be a non-functional placeholder that was automatically
   created by WP core: `Stripe Gateway -> Stripe Gateway`. Because it’s the first
   item in the “Stripe Gateway” submenu, that also changes the URL of the top level“
   Stripe Gateway” menu.
 * I’ll add that submenu item to the internal menu blacklist. The conflict should
   be fixed in the next update. Or you can try the [development version](https://downloads.wordpress.org/plugin/admin-menu-editor.zip)
   that already includes this patch.
 * “Stripe For WooCommerce” could also fix the conflict by changing this line:
    `
   add_action( 'admin_head', array( __CLASS__, 'remove_submenu' ) );`
 * To this:
    `add_action( 'admin_menu', array( __CLASS__, 'remove_submenu' ), 30);`
 * The idea is to use the `admin_menu` hook. The priority only needs to be changed
   to ensure that the method that removes the submenu runs _after_ the method that
   adds the submenu.
 *  Thread Starter [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/menu-issue-with-another-plugin/#post-14011766)
 * Thank you for your detailed answer. Tried your suggestion of adding 30 priority
   to `remove_submenu`, but it didn’t work for me. Anyway, have referred your previous
   post into the OP.
 *  Plugin Author [Janis Elsts](https://wordpress.org/support/users/whiteshadow/)
 * (@whiteshadow)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/menu-issue-with-another-plugin/#post-14011769)
 * Just changing the priority is not enough, the important bit is changing the hook
   from `admin_head` to `admin_menu`.
 *  Thread Starter [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/menu-issue-with-another-plugin/#post-14011795)
 * Nope, it still doesn’t work for me. Here’s the entire block of pertinent code:
 *     ```
       public static function init() {
       	add_action( 'admin_menu', array( __CLASS__, 'admin_menu' ), 10 );
       	add_action( 'admin_menu', array( __CLASS__, 'sub_menu' ), 20 );
         //add_action( 'admin_head', array( __CLASS__, 'remove_submenu' ) );
           add_action( 'admin_menu', array( __CLASS__, 'remove_submenu', 30 ) ); #alx359
       }
   
       public static function admin_menu() {
       	add_menu_page( __( 'Stripe Gateway', 'woo-stripe-payment' ), __( 'Stripe Gateway', 'woo-stripe-payment' ), 'manage_woocommerce', 
       }
   
       public static function sub_menu() {
       	add_submenu_page( 'wc_stripe', __( 'Settings', 'woo-stripe-payment' ), __( 'Settings', 'woo-stripe-payment' ), 
       	add_submenu_page( 'wc_stripe', __( 'Logs', 'woo-stripe-payment' ), __( 'Logs', 'woo-stripe-payment' ), 'manage_woocommerce', 
       	add_submenu_page( 'wc_stripe', __( 'Documentation', 'woo-stripe-payment' ), __( 'Documentation', 'woo-stripe-payment' ), 
       }
   
       public static function remove_submenu() {
       	global $submenu;
       	if ( isset( $submenu['wc_stripe'] ) ) {
       		unset( $submenu['wc_stripe'][0] );
       	}
       }
       ```
   
 *  Plugin Author [Janis Elsts](https://wordpress.org/support/users/whiteshadow/)
 * (@whiteshadow)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/menu-issue-with-another-plugin/#post-14011806)
 * It looks like there’s a typo in your code: the `30` is in the wrong place. It
   should be the third argument to `add_action()`, but it’s inside the callback 
   array instead.
 * That line should look like this:
    `add_action( 'admin_menu', array( __CLASS__,'
   remove_submenu' ), 30 ); #alx359`
 *  Thread Starter [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/menu-issue-with-another-plugin/#post-14011813)
 * Oops, you’re right. Now it works. Thank you! 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Menu Issue with another plugin’ is closed to new replies.

 * ![](https://ps.w.org/admin-menu-editor/assets/icon-128x128.png?rev=1418604)
 * [Admin Menu Editor](https://wordpress.org/plugins/admin-menu-editor/)
 * [Support Threads](https://wordpress.org/support/plugin/admin-menu-editor/)
 * [Active Topics](https://wordpress.org/support/plugin/admin-menu-editor/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/admin-menu-editor/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/admin-menu-editor/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [alx359](https://wordpress.org/support/users/alx359/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/menu-issue-with-another-plugin/#post-14011813)
 * Status: resolved