nav_menu_items_<post_type_name>_recent

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

Description

apply_filters( 'nav_menu_items_<post_type_name>_recent', (array) $most_recent, (array) $args, (array) $box ); 

The dynamic portion(s) of the hook name refer to the post type name.

Parameters (3)

0. $most_recent (array)
An array of post objects being listed.
1. $args (array)
An array of WP_Query arguments.
2. $box (array)
Arguments passed to wp_nav_menu_item_post_type_meta_box().

Usage

To run the hook, copy the example below.
  1. $most_recent = apply_filters( 'nav_menu_items_{$post_type_name}_recent', $most_recent, $args, $box ); 
  2.  
  3. if ( !empty( $most_recent ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the nav_menu_items_<post_type_name>_recent callback 
  2. function filter_nav_menu_items_post_type_name_recent( $most_recent, $args, $box ) { 
  3. // make filter magic happen here... 
  4. return $most_recent
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( "nav_menu_items_{$post_type_name}_recent", 'filter_nav_menu_items_post_type_name_recent', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( "nav_menu_items_{$post_type_name}_recent", 'filter_nav_menu_items_post_type_name_recent', 10, 3 ); 

Defined (1)

The filter is defined in the following location(s).

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