Custom Post Types break admin menu
|Reported by:||TobiasBg||Owned by:|
|Component:||Posts, Post Types||Keywords:||has-patch needs-testing featured|
I have a plugin that uses add_pages_page() to add a menu item to the "Pages" menu of the admin menu.
Due to the Custom Post Types, the corresponding parent page was renamed from "edit-pages.php" to "edit.php?posttype=page".
This breaks the URLs of plugin menu entries that are added to the "Pages" menu, as they will look like "edit.php?posttype=page?page=plugin-slug" (note the two ?).
The reason for this is in the lower part of _wp_menu_output() in wp-admin/menu-header.php, where the "?page=" is hard-coded, like
instead of using add_query_arg().
There are checks for ? in URLs in that function, but they don't seem to get applied for submenu entries.
Change History (18)
- Summary changed from _wp_menu_output() needs to use add_query_arg() to Custom Post Types break admin menu
- Keywords has-patch needs-testing featured added; needs-patch removed