Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: nav_menu_attr_title

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
610
611                } else {
612                     $menu_item->type_label = __('Custom');
613                     $menu_item->title = $menu_item->post_title;
614                     $menu_item->url = empty( $menu_item->url ) ? get_post_meta( $menu_item->ID, '_menu_item_url', true ) : $menu_item->url;
615                }
616
617                $menu_item->target = empty( $menu_item->target ) ? get_post_meta( $menu_item->ID, '_menu_item_target', true ) : $menu_item->target;
618
619                $menu_item->attr_title = empty( $menu_item->attr_title ) ? apply_filters( 'nav_menu_attr_title', $menu_item->post_excerpt ) : $menu_item->attr_title;
620
621                if ( empty( $menu_item->description ) )
622                     $menu_item->description = apply_filters( 'nav_menu_description',  wp_trim_words( $menu_item->post_content, 200 ) );
623
624                $menu_item->classes = empty( $menu_item->classes ) ? (array) get_post_meta( $menu_item->ID, '_menu_item_classes', true ) : $menu_item->classes;
625                $menu_item->xfn = empty( $menu_item->xfn ) ? get_post_meta( $menu_item->ID, '_menu_item_xfn', true ) : $menu_item->xfn;
626           } else {
627                $menu_item->db_id = 0;
628                $menu_item->menu_item_parent = 0;
 
Line Code
631
632                $object = get_post_type_object( $menu_item->post_type );
633                $menu_item->object = $object->name;
634                $menu_item->type_label = $object->labels->singular_name;
635
636                $menu_item->title = $menu_item->post_title;
637                $menu_item->url = get_permalink( $menu_item->ID );
638                $menu_item->target = '';
639
640                $menu_item->attr_title = apply_filters( 'nav_menu_attr_title', '' );
641                $menu_item->description = apply_filters( 'nav_menu_description', '' );
642                $menu_item->classes = array();
643                $menu_item->xfn = '';
644           }
645      } elseif ( isset( $menu_item->taxonomy ) ) {
646           $menu_item->ID = $menu_item->term_id;
647           $menu_item->db_id = 0;
648           $menu_item->menu_item_parent = 0;
649           $menu_item->object_id = (int) $menu_item->term_id;