nav_menu_description хук-фильтрWP 3.0.0

Filters a navigation menu item's description.

Использование

add_filter( 'nav_menu_description', 'wp_kama_nav_menu_description_filter' );

/**
 * Function for `nav_menu_description` filter-hook.
 * 
 * @param string $description The menu item description.
 *
 * @return string
 */
function wp_kama_nav_menu_description_filter( $description ){

	// filter...
	return $description;
}
$description(строка)
The menu item description.

Список изменений

С версии 3.0.0 Введена.

Где вызывается хук

wp_setup_nav_menu_item()
nav_menu_description
WP_Customize_Nav_Menu_Item_Setting::value_as_wp_post_nav_menu_item()
nav_menu_description
wp-includes/nav-menu.php 926
$menu_item->description = apply_filters( 'nav_menu_description', wp_trim_words( $menu_item->post_content, 200 ) );
wp-includes/nav-menu.php 954
$menu_item->description = apply_filters( 'nav_menu_description', '' );
wp-includes/customize/class-wp-customize-nav-menu-item-setting.php 641
$post->description = apply_filters( 'nav_menu_description', wp_trim_words( $post->description, 200 ) );

Где используется хук в WordPress

wp-includes/default-filters.php 160
add_filter( $filter, 'wptexturize' );
wp-includes/default-filters.php 161
add_filter( $filter, 'strip_tags' );