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