nav_menu_description

This filter is documented in wp-includes/nav-menu.php.

Description

apply_filters( 'nav_menu_description', (unknown) $wp_trim_words ); 

Parameters (1)

0. $wp_trim_words (unknown) => wp_trim_words( $post->description, 200 )
The wp trim words.

Usage

To run the hook, copy the example below.
  1. $wp_trim_words = apply_filters( 'nav_menu_description', $wp_trim_words ); 
  2.  
  3. if ( !empty( $wp_trim_words ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the nav_menu_description callback 
  2. function filter_nav_menu_description( $wp_trim_words ) { 
  3. // make filter magic happen here... 
  4. return $wp_trim_words
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'nav_menu_description', 'filter_nav_menu_description', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'nav_menu_description', 'filter_nav_menu_description', 10, 1 ); 

Defined (3)

The filter is defined in the following location(s).

/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php  
  1. $post->description = apply_filters( 'nav_menu_description', wp_trim_words( $post->description, 200 ) ); 
/wp-includes/nav-menu.php  
  1. $menu_item->description = apply_filters( 'nav_menu_description', wp_trim_words( $menu_item->post_content, 200 ) ); 
  1. $menu_item->description = apply_filters( 'nav_menu_description', '' );