_wp_nav_menu_meta_box_object() – Adds custom arguments to some of the meta box object types.

You appear to be a bot. Output may be restricted

Description

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

Usage

$object = _wp_nav_menu_meta_box_object( $data_object );

Parameters

$data_object
( object ) optional – The post type or taxonomy meta-object.

Returns

object The post type or taxonomy object.

Source

File name: wordpress/wp-admin/includes/nav-menu.php


Lines:

1 to 33 of 33
function _wp_nav_menu_meta_box_object( $data_object = null ) {
  if ( isset( $data_object->name ) ) {

    if ( 'page' === $data_object->name ) {
      $data_object->_default_query = array(
        'orderby'     => 'menu_order title',
        'post_status' => 'publish',
      );

      // Posts should show only published items.
    } elseif ( 'post' === $data_object->name ) {
      $data_object->_default_query = array(
        'post_status' => 'publish',
      );

      // Categories should be in reverse chronological order.
    } elseif ( 'category' === $data_object->name ) {
      $data_object->_default_query = array(
        'orderby' => 'id',
        'order'   => 'DESC',
      );

      // Custom post types should show only published items.
    } else {
      $data_object->_default_query = array(
        'post_status' => 'publish',
      );
    }
  }

  return $data_object;
}
 

 View on GitHub View on Trac