WordPress.org

Make WordPress Core

Ticket #45361: 45361.diff

File 45361.diff, 666 bytes (added by audrasjb, 20 months ago)

Doing it wrong: Menu location slug should not be a int.

  • src/wp-includes/nav-menu.php

    diff --git a/src/wp-includes/nav-menu.php b/src/wp-includes/nav-menu.php
    index 9b6eeba..2886095 100644
    a b function register_nav_menus( $locations = array() ) { 
    9292
    9393        add_theme_support( 'menus' );
    9494
     95        foreach ( $locations as $key => $value ) {
     96                if ( is_int( $key ) ) {
     97                        /* translators: %s: menu location value */
     98                        $message = sprintf( __( 'Menu location slug (key) for menu "%s" should not be a int.' ), $value );
     99                        _doing_it_wrong( __FUNCTION__, $message, '5.2' );
     100                }
     101        }
     102
    95103        $_wp_registered_nav_menus = array_merge( (array) $_wp_registered_nav_menus, $locations );
    96104}
    97105