Integer menu slugs are no longer supported from WordPress 5.3

Previously, menus could be registered with an integer slug. This used to cause unintended issues that are difficult to debug.

Consider the following use of register_nav_menus:

        'primary' => 'Primary', 
        1 => 'First', 
        2 => 'Second',

The assumption is that the resulting list of menus would match what was passed. Instead, the result is this:

    'primary' => 'Primary', 
    0 => 'First', 
    1 => 'Second', 

This would cause wp_nav_menu( array( 'theme_location' => 1 ) ) to return the wrong menu.

From WordPress 5.3, it will trigger a _doing_it_wrong() warning when registering a nav menu with a numeric index. This will at least inform developers of the potential issue, and would also encourage better practices of using a string slug for nav menus.

For reference, see the related TracTrac An open source project by Edgewall Software that serves as a bug tracker and project management tool for WordPress. ticketticket Created for both bug reports and feature development on the bug tracker.: #45361

#5-3, #dev-notes