[wp-trac] [WordPress Trac] #52035: The `add_submenu_page()` position is ignored.
WordPress Trac
noreply at wordpress.org
Fri Dec 11 16:03:26 UTC 2020
#52035: The `add_submenu_page()` position is ignored.
----------------------------+-----------------------------
Reporter: Howdy_McGee | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Menus | Version:
Severity: normal | Keywords:
Focuses: administration |
----------------------------+-----------------------------
Hello,
I'm not sure that the `add_submenu_page()` position argument is being
applied properly. See the below example:
{{{#!php
<?php
add_action( 'admin_menu', function() {
add_submenu_page(
'edit.php',
'Foo',
'Foo',
'list_users',
'foo',
function() {
echo 'Hello Foo';
},
200,
);
add_submenu_page(
'edit.php',
'Bar',
'Bar',
'list_users',
'bar',
function() {
echo 'Hello Bar';
},
100,
);
} );
}}}
I would expect "Bar" to appear before "Foo" since it has a lower position
number. What ends up happening is whichever `add_submenu_page()` was
called first, gets position priority.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52035>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list