The seventh parameter passed to add_submenu_page()

I’m testing WordPress 5.3 (5.3-RC4-46673) with my theme. I have WP_DEBUG enabled. I notice the following error in the dashboard now:

Notice: add_submenu_page was called incorrectly. The seventh parameter passed to add_submenu_page() should be an integer representing menu position. Please see Debugging in WordPress for more information. (This message was added in version 5.3.0.) in /app/wp-includes/functions.php on line 4903

There’s a related ticket for this error here: Trac Ticket #48249

Troubleshooting
The theme I’m using is a child theme.

  • Disabled all plugins, issue persists.
  • Issue happens with child them active and parent theme active.
  • Issue goes away with twentynineteen.

So it’s definitely within the theme. Just not sure how to go about tracking this down.

4 Answers
4

I was able to track this down to the culprit function add_theme_page(). There

There was an additional parameter, per the codex for add_theme_page() that needed to be removed. Removing that seemed to help.

function fivehundred_register_admin_menu() {
  add_theme_page(
    '500 Settings',
    '500 Settings',
    'manage_options',
    'theme-settings',
    'fivehundred_admin_menu',
    plugins_url( '/ignitiondeck/images/ignitiondeck-menu.png' )
  );
}

add_action(
  'admin_menu',
  'fivehundred_register_admin_menu'
);

Fixed code

function fivehundred_register_admin_menu() {
  add_theme_page(
    '500 Settings',
    '500 Settings',
    'manage_options',
    'theme-settings',
    'fivehundred_admin_menu'
  );
}

add_action(
  'admin_menu',
  'fivehundred_register_admin_menu'
);

Leave a Comment