[wp-trac] [WordPress Trac] #52035: The `add_submenu_page()` position is ignored.

WordPress Trac noreply at wordpress.org
Sun Jan 18 08:41:44 UTC 2026


#52035: The `add_submenu_page()` position is ignored.
----------------------------+------------------------------
 Reporter:  Howdy_McGee     |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:  administration
----------------------------+------------------------------
Changes (by ozgursar):

 * keywords:  has-patch needs-testing => has-patch


Comment:

 == Test Report
 === Description
 This report validates whether the indicated patch works as expected.

 Patch tested: https://github.com/WordPress/wordpress-develop/pull/6971

 === Environment
 - WordPress: 7.0-alpha-61215-src
 - PHP: 8.2.29
 - Server: nginx/1.29.4
 - Database: mysqli (Server: 8.4.7 / Client: mysqlnd 8.2.29)
 - Browser: Chrome 143.0.0.0
 - OS: macOS
 - Theme: Twenty Twenty-Five 1.4
 - MU Plugins: None activated
 - Plugins:
   * Code Snippets 3.9.4
   * Test Reports 1.2.1

 === Steps to Reproduce
 1. Install Code Snippets plugin to add the following snippet.
 (Alternatively add it into the functions.php of the theme)


 {{{
 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,
         );

 } );
 }}}

 2. In admin dashboard, view the Posts menu.
 3. Without patch Foo is displayed above Bar

 === Actual Results
 1.  ✅ Issue resolved with patch.

 === Additional Notes
 - Tested submenu position by changing the last argument of
 add_submenu_page() function. Zero places the submenu item at the top and
 larger value places it below the items having lower values.

 === Supplemental Artifacts
 Before:
 [[Image(https://i.imgur.com/EDSxLP8.png)]]

 After:
 [[Image(https://i.imgur.com/fWXdBTa.png)]]

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52035#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list