_wp_nav_menu_meta_box_object

Adds custom arguments to some of the meta box object types.

Description

(object) _wp_nav_menu_meta_box_object( (null) $object = null ); 

Returns (object)

The post type of taxonomy object.

Parameters (1)

0. $object — Optional. (null) => null
The post type or taxonomy meta-object.

Usage

  1. if ( !function_exists( '_wp_nav_menu_meta_box_object' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/nav-menu.php'; 
  3.  
  4. // The post type or taxonomy meta-object. 
  5. $object = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = _wp_nav_menu_meta_box_object($object); 
  9.  

Defined (1)

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

/wp-admin/includes/nav-menu.php  
  1. function _wp_nav_menu_meta_box_object( $object = null ) { 
  2. if ( isset( $object->name ) ) { 
  3.  
  4. if ( 'page' == $object->name ) { 
  5. $object->_default_query = array( 
  6. 'orderby' => 'menu_order title',  
  7. 'post_status' => 'publish',  
  8. ); 
  9.  
  10. // Posts should show only published items. 
  11. } elseif ( 'post' == $object->name ) { 
  12. $object->_default_query = array( 
  13. 'post_status' => 'publish',  
  14. ); 
  15.  
  16. // Categories should be in reverse chronological order. 
  17. } elseif ( 'category' == $object->name ) { 
  18. $object->_default_query = array( 
  19. 'orderby' => 'id',  
  20. 'order' => 'DESC',  
  21. ); 
  22.  
  23. // Custom post types should show only published items. 
  24. } else { 
  25. $object->_default_query = array( 
  26. 'post_status' => 'publish',  
  27. ); 
  28.  
  29. return $object;