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
913
914                if ( ! isset( $menu_item->description ) ) {
915                     /**
916                      * Filters a navigation menu item's description.
917                      *
918                      * @since 3.0.0
919                      *
920                      * @param string $description The menu item description.
921                      */
922                     $menu_item->description = apply_filters( 'nav_menu_description', wp_trim_words( $menu_item->post_content, 200 ) );
923                }
924
925                $menu_item->classes = ! isset( $menu_item->classes ) ? (array) get_post_meta( $menu_item->ID, '_menu_item_classes', true ) : $menu_item->classes;
926                $menu_item->xfn     = ! isset( $menu_item->xfn ) ? get_post_meta( $menu_item->ID, '_menu_item_xfn', true ) : $menu_item->xfn;
927           } else {
928                $menu_item->db_id            = 0;
929                $menu_item->menu_item_parent = 0;
930                $menu_item->object_id        = (int) $menu_item->ID;
931                $menu_item->type             = 'post_type';
 
Line Code
941
942                $menu_item->title  = $menu_item->post_title;
943                $menu_item->url    = get_permalink( $menu_item->ID );
944                $menu_item->target = '';
945
946                /** This filter is documented in wp-includes/nav-menu.php */
947                $menu_item->attr_title = apply_filters( 'nav_menu_attr_title', '' );
948
949                /** This filter is documented in wp-includes/nav-menu.php */
950                $menu_item->description = apply_filters( 'nav_menu_description', '' );
951                $menu_item->classes     = array();
952                $menu_item->xfn         = '';
953           }
954      } elseif ( isset( $menu_item->taxonomy ) ) {
955           $menu_item->ID               = $menu_item->term_id;
956           $menu_item->db_id            = 0;
957           $menu_item->menu_item_parent = 0;
958           $menu_item->object_id        = (int) $menu_item->term_id;
959           $menu_item->post_parent      = (int) $menu_item->parent;