Support » Fixing WordPress » add_submenu_page was called incorrectly

  • After updating to wordpress 5.3 this error keeps showing up on my dashboard page

    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 /home/mushabi/public_html/wp-includes/functions.php on line 4986

    Warning: Cannot modify header information – headers already sent by (output started at /home/mushabi/public_html/wp-includes/functions.php:4986) in /home/mushabi/public_html/wp-includes/functions.php on line 6029

    Warning: Cannot modify header information – headers already sent by (output started at /home/mushabi/public_html/wp-includes/functions.php:4986) in /home/mushabi/public_html/wp-admin/includes/misc.php on line 1252

    Warning: Cannot modify header information – headers already sent by (output started at /home/mushabi/public_html/wp-includes/functions.php:4986) in /home/mushabi/public_html/wp-admin/admin-header.php on line 9

    How should I fix it?

    Screenshot-1

    Screenshot-2

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • You have somewhere used the add_theme_page() or add_management_page() function. Both of the functions are using the add_submenu_page() function like

    
    function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $position = null ) {
        return add_submenu_page( 'themes.php', $page_title, $menu_title, $capability, $menu_slug, $function, $position );
    }
    

    You need to add null as the last parameter to avoid this warning. For example if you have the codes like

    
    add_theme_page( 'Theme Title Settings', 'Theme Menu Settings', 'edit_theme_options', 'test-theme-options', 'theme_option_page', '' ); 
    

    then you need to update it with

    
    add_theme_page( 'Theme Title Settings', 'Theme Menu Settings', 'edit_theme_options', 'test-theme-options', 'theme_option_page', null );
    
    • This reply was modified 4 months, 4 weeks ago by jogesh_pi.
    • This reply was modified 4 months, 4 weeks ago by jogesh_pi.

    Where should I look for it to change it to null?

    The better and quick fix is to disable the errors from the wp-config.php file and find the WP_DEBUG at the very bottom of the file.

    That should have the following codes to disable errors.

    define('WP_DEBUG', false);

    It is just a notice with warning and nothing to get worried about.
    And if you want to fix it, then you have to navigate to the themes or the plugins which are very hard to do.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.