Make WordPress Core

Opened 5 years ago

Closed 8 weeks ago

Last modified 8 weeks ago

#14159 closed defect (bug) (fixed)

menu_page_url not returning correct URL for custom submenus

Reported by: williamsba1 Owned by:
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.0
Component: Plugins Keywords: has-patch
Focuses: administration Cc:


When using the menu_page_url() function to determine the URL to a submenu of a custom top-level menu it's not returning the correct URL.

The function returns:

The correct URL is:

For reference my submenu is registered like so:

add_submenu_page('cpt_main_menu', 'Add New', 'Add New', 'administrator', 'cpt_sub_add_new', 'cpt_add_new');

I tested this on the custom top level menu and the URL returned is correct. It only appears to be an issue with submenus of a custom top level menu

Attachments (1)

14159.diff (3.1 KB) - added by duck_ 5 years ago.

Download all attachments as: .zip

Change History (10)

#1 @nacin
5 years ago

  • Cc westi added
  • Component changed from General to Plugins
  • Milestone changed from Awaiting Review to 3.1

5 years ago

#2 @duck_
5 years ago

  • Keywords has-patch added

If the menu item's parent is unset then it's a submenu of a builtin menu otherwise it also has an admin.php URL.

Was also thinking of trying to get menu_page_url to work for the predefined menu slugs (e.g. tools.php)

Updated unit-tests at #UT10

#3 @nacin
5 years ago

(In [16829]) Fix menu_page_url() for submenu pages attached to custom menu pages. props duck_, see #14159.

#4 @nacin
5 years ago

Was also thinking of trying to get menu_page_url to work for the predefined menu slugs (e.g. tools.php)


#5 @nacin
5 years ago

  • Milestone changed from 3.1 to Future Release

#6 @nacin
22 months ago

  • Component changed from Plugins to Admin APIs
  • Focuses administration added

#7 @nacin
22 months ago

  • Component changed from Admin APIs to Plugins

Sorry for the noise.

#8 @chriscct7
8 weeks ago

  • Resolution set to fixed
  • Status changed from new to closed

Doesn't appear to be anything left to fix per the original ticket. If there's still interest in comment:3, that could be split off into a new ticket and pursued.

#9 @chriscct7
8 weeks ago

  • Milestone changed from Future Release to 3.1
Note: See TracTickets for help on using tickets.