WordPress开发者和主题制作者的搜索引擎



_wp_nav_menu_meta_box_object ›

Since3.0.0
已弃用n/a
_wp_nav_menu_meta_box_object ( $object = null )
访问:
  • private
参数:
  • (object) $object The post type or taxonomy meta-object.
    Required: No
    默认: null
返回:
  • (object) The post type of taxonomy object.
定义在:
文档:

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



源码

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;
}