Make posts in the 'Most recent' tab of post type meta boxes filterable.

Provides parity with the 'View All' tab of post type meta boxes in Appearance > Menus.

Props jpyper, chriscct7.
Fixes #19365.



git-svn-id: https://develop.svn.wordpress.org/trunk@32833 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Konstantin Obenland 2015-06-18 11:34:33 +00:00
parent fa1a214eb6
commit 77d2e23a69
1 changed files with 13 additions and 0 deletions

View File

@ -728,6 +728,19 @@ function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) {
$recent_args = array_merge( $args, array( 'orderby' => 'post_date', 'order' => 'DESC', 'posts_per_page' => 15 ) );
$most_recent = $get_posts->query( $recent_args );
$args['walker'] = $walker;
/**
* Filter the posts displayed in the 'Most Recent' tab of the current
* post type's menu items meta box.
*
* @since 4.3.0
*
* @param array $most_recent An array of post objects being listed.
* @param array $args An array of WP_Query arguments.
* @param object $post_type The current post type object for this menu item meta box.
*/
$most_recent = apply_filters( "nav_menu_items_{$post_type_name}_recent", $most_recent, $args, $post_type );
echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $most_recent), 0, (object) $args );
?>
</ul>