WordPress.org

Make WordPress Core

Ticket #13910: 13910.patch

File 13910.patch, 1.1 KB (added by sagarprajapati, 3 years ago)
  • src/wp-includes/nav-menu.php

     
    185185}
    186186
    187187/**
     188 * Returns the title of a navigation menu
     189 *
     190 * @since 4.8.1
     191 *
     192 * @param string $theme_location Location of a navigation menu in a theme.
     193 * @return string
     194 */
     195function wp_nav_menu_title( $theme_location ) {
     196        $title = '';
     197        if ( $theme_location && ( $locations = get_nav_menu_locations() ) && isset( $locations[ $theme_location ] ) ) {
     198                $menu = wp_get_nav_menu_object( $locations[ $theme_location ] );
     199
     200                if ( $menu && $menu->name ) {
     201                        $title = $menu->name;
     202                }
     203        }
     204        /**
     205         * Filter navigation menu title with the location of a navigation menu in a theme.
     206         *
     207         * @since 4.8.1
     208         *
     209         * @param string $title Title of the navigation menu.
     210         * @param string $theme_location Location of a navigation menu in a theme.
     211         */
     212        return apply_filters( 'wp_nav_menu_title', $title, $theme_location );
     213}
     214
     215/**
    188216 * Determines whether the given ID is a nav menu item.
    189217 *
    190218 * @since 3.0.0