WP_Navigation_Block_Renderer::get_unique_navigation_name
Returns a unique name for the navigation.
Method of the class: WP_Navigation_Block_Renderer{}
No Hooks.
Returns
String
. Returns a unique name for the navigation.
Usage
$result = WP_Navigation_Block_Renderer::get_unique_navigation_name( $attributes );
- $attributes(array) (required)
- The block attributes.
Changelog
Since 6.5.0 | Introduced. |
WP_Navigation_Block_Renderer::get_unique_navigation_name() WP Navigation Block Renderer::get unique navigation name code WP 6.8.1
private static function get_unique_navigation_name( $attributes ) { $nav_menu_name = static::get_navigation_name( $attributes ); // If the menu name has been used previously then append an ID // to the name to ensure uniqueness across a given post. if ( isset( static::$seen_menu_names[ $nav_menu_name ] ) && static::$seen_menu_names[ $nav_menu_name ] > 1 ) { $count = static::$seen_menu_names[ $nav_menu_name ]; $nav_menu_name = $nav_menu_name . ' ' . ( $count ); } return $nav_menu_name; }