Previously, menus could be registered using the integer slug, but this caused an unexpected problem that was difficult to debug. For example, suppose we use the following code to register the menu through the register_nav_menus function:
register_nav_menus( array( 'primary' => 'Primary', 1 => 'First', 2 => 'Second', ) );
Under normal circumstances, the 1 above should correspond to the "First" menu, but the actual result is not like this, but is the same as the following:
array( 'primary' => 'Primary', 0 => 'First', 1 => 'Second', )
That is, when you call the menu through wp_nav_menu (array ('theme_location '=>1)), the output may not be the First menu, but the Second menu. Obviously, this is not the result we want.
This is because WordPress uses array_merge() to add the new navigation menu location to the global $_wp_registered_nav_menus variable. The array_merge() will rename the numeric index and increment the key name from zero in the result array, which causes the above situation.
Therefore, starting from WordPress 5.3, integer is no longer supported as the slug of the menu. If still used, WP will display a warning message through _doing_it_wrong(), telling developers that they need to use string as slug for menu registration.
Small beast wordpress relies on years of Wordpress enterprise theme Production experience, adhering to the purpose of "wordpress theme born for users", has provided quality wordpress website building services for more than 100000 customers, and has received unanimous praise from customers. We always treat every customer with our heart. We firmly believe that "treat customers well, and they will become lifelong customers". Wordpress can persist for many years because we are always honest. We clearly mark the price( How much does wordpress cost to build a website )We never cheat any customer. Our quotation tenet is: "refuse to make excessive profits and only keep reasonable profits". If you have a need for website construction, website revision, website maintenance, etc., please immediately consult the online customer service on the right or call the hotline: 18907337671, and we will answer your questions one by one in detail.