Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: nav_menu_description

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
698
699                if ( empty( $menu_item->description ) ) {
700                     /**
701                      * Filter a navigation menu item's description.
702                      *
703                      * @since 3.0.0
704                      *
705                      * @param string $description The menu item description.
706                      */
707                     $menu_item->description = apply_filters( 'nav_menu_description', wp_trim_words( $menu_item->post_content, 200 ) );
708                }
709
710                $menu_item->classes = empty( $menu_item->classes ) ? (array) get_post_meta( $menu_item->ID, '_menu_item_classes', true ) : $menu_item->classes;
711                $menu_item->xfn = empty( $menu_item->xfn ) ? get_post_meta( $menu_item->ID, '_menu_item_xfn', true ) : $menu_item->xfn;
712           } else {
713                $menu_item->db_id = 0;
714                $menu_item->menu_item_parent = 0;
715                $menu_item->object_id = (int) $menu_item->ID;
716                $menu_item->type = 'post_type';
 
Line Code
724
725                $menu_item->title = $menu_item->post_title;
726                $menu_item->url = get_permalink( $menu_item->ID );
727                $menu_item->target = '';
728
729                /** This filter is documented in wp-includes/nav-menu.php */
730                $menu_item->attr_title = apply_filters( 'nav_menu_attr_title', '' );
731
732                /** This filter is documented in wp-includes/nav-menu.php */
733                $menu_item->description = apply_filters( 'nav_menu_description', '' );
734                $menu_item->classes = array();
735                $menu_item->xfn = '';
736           }
737      } elseif ( isset( $menu_item->taxonomy ) ) {
738           $menu_item->ID = $menu_item->term_id;
739           $menu_item->db_id = 0;
740           $menu_item->menu_item_parent = 0;
741           $menu_item->object_id = (int) $menu_item->term_id;
742           $menu_item->post_parent = (int) $menu_item->parent;