_wp_get_default_posttype_form() │ WP 7.1.0

Builds the default form configuration for post types that don't provide their own.

It is a sensible default for post, page, and custom post types alike rather than being tailored per type. Post types that need a different shape can replace it entirely with a dedicated form through their own filter callback.

It is intentionally NOT gated by supports. The registered fields are the single source of truth for what applies: each field is registered for a post type based on its supports (and related flags such as theme_supports), and the editor drops any form field whose definition is absent or whose isVisible returns false.

Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.

Хуков нет.

Возвращает

array. The default form configuration.

Использование

_wp_get_default_posttype_form();

Список изменений

С версии 7.1.0 Введена.

Код _wp_get_default_posttype_form() WP 7.1.2

function _wp_get_default_posttype_form() {
	return array(
		'layout' => array( 'type' => 'panel' ),
		'fields' => array(
			array(
				'id'     => 'featured_media',
				'layout' => array(
					'type'          => 'regular',
					'labelPosition' => 'none',
				),
			),
			array(
				'id'     => 'post-content-info',
				'layout' => array(
					'type'          => 'regular',
					'labelPosition' => 'none',
				),
			),
			array(
				'id'     => 'excerpt',
				'layout' => array(
					'type'          => 'panel',
					'labelPosition' => 'top',
				),
			),
			array(
				'id'       => 'status',
				'label'    => __( 'Status' ),
				'children' => array(
					array(
						'id'     => 'status',
						'layout' => array(
							'type'          => 'regular',
							'labelPosition' => 'none',
						),
					),
					'scheduled_date',
					'password',
					'sticky',
				),
			),
			'date',
			'slug',
			'author',
			'template',
			array(
				'id'       => 'discussion',
				'label'    => __( 'Discussion' ),
				'children' => array(
					array(
						'id'     => 'comment_status',
						'layout' => array(
							'type'          => 'regular',
							'labelPosition' => 'none',
						),
					),
					'ping_status',
				),
			),
			'parent',
			'format',
			'revisions',
		),
	);
}