W3cubDocs

/WordPress

_wp_nav_menu_meta_box_object( object $object = null )

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

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

Parameters

$object

(object) (Optional) The post type or taxonomy meta-object.

Default value: null

Return

(object) The post type or taxonomy object.

Source

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

function _wp_nav_menu_meta_box_object( $object = null ) {
	if ( isset( $object->name ) ) {

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

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

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

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

	return $object;
}

Changelog

Version Description
3.0.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_wp_nav_menu_meta_box_object