Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: nav_menu_item_id

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

Line Code
102           /**
103            * Filter the ID applied to a menu item's <li>.
104            *
105            * @since 3.0.1
106            *
107            * @param string The ID that is applied to the menu item's <li>.
108            * @param object $item The current menu item.
109            * @param array $args An array of arguments. @see wp_nav_menu()
110            */
111           $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
112           $id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
113
114           $output .= $indent . '<li' . $id . $value . $class_names .'>';
115
116           $atts = array();
117           $atts['title']  = ! empty( $item->attr_title ) ? $item->attr_title : '';
118           $atts['target'] = ! empty( $item->target )     ? $item->target     : '';
119           $atts['rel']    = ! empty( $item->xfn )        ? $item->xfn        : '';
120           $atts['href']   = ! empty( $item->url )        ? $item->url        : '';