Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: nav_menu_items_{$post_type_name}

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
637                      * @since 4.6.0 Converted the `$post_type` parameter to accept a WP_Post_Type object.
638                      *
639                      * @see WP_Query::query()
640                      *
641                      * @param object[]     $posts     The posts for the current post type. Mostly `WP_Post` objects, but
642                      *                                can also contain "fake" post objects to represent other menu items.
643                      * @param array        $args      An array of `WP_Query` arguments.
644                      * @param WP_Post_Type $post_type The current post type object for this menu item meta box.
645                      */
646                     $posts = apply_filters( "nav_menu_items_{$post_type_name}", $posts, $args, $post_type );
647
648                     $checkbox_items = walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $posts ), 0, (object) $args );
649
650                     echo $checkbox_items;
651                     ?>
652                </ul>
653                <?php if ( ! empty( $page_links ) ) : ?>
654                     <div class="add-menu-item-pagelinks">
655                          <?php echo $page_links; ?>