nav_menu_items_post_recent хук-фильтрWP 4.3.0

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

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

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

add_filter( 'nav_menu_items_post_recent', 'wp_kama_nav_menu_items_post_recent_filter', 10, 4 );

/**
 * Function for `nav_menu_items_post_recent` filter-hook.
 * 
 * @param WP_Post[] $most_recent An array of post objects being listed.
 * @param array     $args        An array of `WP_Query` arguments for the meta box.
 * @param array     $box         Arguments passed to `wp_nav_menu_item_post_type_meta_box()`.
 * @param array     $recent_args An array of `WP_Query` arguments for 'Most Recent' tab.
 *
 * @return WP_Post[]
 */
function wp_kama_nav_menu_items_post_recent_filter( $most_recent, $args, $box, $recent_args ){

	// filter...
	return $most_recent;
}
$most_recent(WP_Post[])
An array of post objects being listed.
$args(массив)
An array of WP_Query arguments for the meta box.
$box(массив)
Arguments passed to wp_nav_menu_item_post_type_meta_box().
$recent_args(массив)
An array of WP_Query arguments for 'Most Recent' tab.

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

С версии 4.3.0 Введена.
С версии 4.9.0 Added the $recent_args parameter.

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

wp_nav_menu_item_post_type_meta_box()
nav_menu_items_post_recent
wp-admin/includes/nav-menu.php 643-649
$most_recent = apply_filters(
	"nav_menu_items_{$post_type_name}_recent",
	$most_recent,
	$args,
	$box,
	$recent_args
);

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

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