WordPress.org

Make WordPress Core

Opened 4 weeks ago

Last modified 4 weeks ago

#44460 new defect (bug)

Menu Items Conflict

Reported by: wlpdrpat Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Menus Keywords: has-screenshots reporter-feedback
Focuses: Cc:

Description

This issue was fixed in version 4.4 per https://core.trac.wordpress.org/ticket/23316

The latest version of WP the issue resurfaced.

function add_menu_page position values that conflict will either hide primary side menu items or the side menu items will hide the new menu pages:

Defining the position value as 0 or 1 causes the new menu item to hide the Dashboard menu item.

Defining the position value as 2 causes the Dashboard menu item to hide the new menu item.

Defining the position value as 3 or 4 causes the new menu item to hide the Posts menu item.

Defining the position value as 5 causes the Posts menu item to hide the new menu item.

I didn't research it any further but there is definitely a reintroduction of the bug that was previously resolved.

There is no method of defining position to display a new menu item above Dashboard or between Dashboard and Posts. If 2 menu items are created with defined position values between 0-4 then both the Dashboard and Posts menu item are hidden or hide the new menu items depending on the defined values.

Attachments (1)

menu-items-by-positions.png (15.1 KB) - added by subrataemfluence 4 weeks ago.

Download all attachments as: .zip

Change History (3)

#1 @wlpdrpat
4 weeks ago

This bug also breaks the functionality of this plugin: https://wordpress.org/plugins/link-manager/

The plugin is supposed to display the Link Manager menu item.

If an additional add_menu_page is defined with position 0-5 then the Links Manager menu item displays but the Media menu item is not displayed. If no add_menu_page is defined with position 0-5 then Media menu item is displayed and Links Manager is not displayed.

#2 @subrataemfluence
4 weeks ago

  • Component changed from General to Menus
  • Keywords has-screenshots reporter-feedback added

I could not reproduce the error.

The following code in my theme's functions.php generated 6 menu items but no existing item or new item got hidden by one another.

<?php
function add_menu_item(){
   $position_arr = array( 0, 1, 2, 3, 4, 5 );
   foreach ( $position_arr as $item ) {
        add_menu_page(
                'Item-' . $item,
                'ITEM-' . $item,
                'manage_options',
                'item-' . $item,
                '',
                'dashicons-wordpress-alt',
                $item
        );
   }
}

add_action('admin_menu', 'add_menu_item');

I have attached a screenshot of my admin page with all existing and new menu items visible.

Do I need anything else to reproduce the error?

Project configuration:

  • WordPress version: 4.9.6
  • Theme: twentyseventeen
  • Installation type: Single site
Last edited 4 weeks ago by subrataemfluence (previous) (diff)
Note: See TracTickets for help on using tickets.