nav_menu_items_post хук-фильтрWP 3.2.0

Filters the posts displayed in the 'View All' tab of the current post type's menu items meta box.

Это один из вариантов динамического хука nav_menu_items_(post_type_name)

Использование

add_filter( 'nav_menu_items_post', 'wp_kama_nav_menu_items_post_filter', 10, 3 );

/**
 * Function for `nav_menu_items_post` filter-hook.
 * 
 * @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.
 *
 * @return object[]
 */
function wp_kama_nav_menu_items_post_filter( $posts, $args, $post_type ){

	// filter...
	return $posts;
}
$posts(object[])
The posts for the current post type. Mostly WP_Post objects, but can also contain "fake" post objects to represent other menu items.
$args(массив)
An array of WP_Query arguments.
$post_type(WP_Post_Type)
The current post type object for this menu item meta box.

Список изменений

С версии 3.2.0 Введена.
С версии 4.6.0 Converted the $post_type parameter to accept a WP_Post_Type object.

Где вызывается хук

wp_nav_menu_item_post_type_meta_box()
nav_menu_items_post
wp-admin/includes/nav-menu.php 655
$posts = apply_filters( "nav_menu_items_{$post_type_name}", $posts, $args, $post_type );

Где используется хук в WordPress

Использование не найдено.