apply_filters( "nav_menu_items_{$post_type_name}", object[] $posts, array $args, WP_Post_Type $post_type )
- Since
- 3.2.0, 4.6.0
Filters the posts displayed in the 'View All' tab of the current post type's menu items meta box.
Description
The dynamic portion of the hook name, $post_type_name, refers to the slug of the current post type.
Possible hook names include:
nav_menu_items_postnav_menu_items_page
Compatibility
- WordPress
- since 4.6.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$postsobject[]- The posts for the current post type. Mostly
WP_Postobjects, but can also contain "fake" post objects to represent other menu items. $argsarray- An array of
WP_Queryarguments. $post_typeWP_Post_Type- The current post type object for this menu item meta box.
Where this hook fires · 1
wp-admin/includes/nav-menu.php:799wp_nav_menu_item_post_type_meta_box()
Source code
* * @param object[] $posts The posts for the current post type. Mostly `WP_Post` objects, but * can also contain "fake" post objects to represent other menu items. * @param array $args An array of `WP_Query` arguments. * @param WP_Post_Type $post_type The current post type object for this menu item meta box. */ $posts = apply_filters( "nav_menu_items_{$post_type_name}", $posts, $args, $post_type );Changelog
Introduced in 3.2.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
4.6.0
Converted the
$post_type parameter to accept a WP_Post_Type object.from the docblock3.2.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.