Builds the default form configuration for post types that don’t provide their own.
Description
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.
Source
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',
),
);
}
Changelog
| Version | Description |
|---|---|
| 7.1.0 | Introduced. |
This is the starting point, not the final form
The array returned here is unfiltered. What the editor actually receives is the return of
wp_get_entity_view_config( 'postType', $name )— this default after theget_entity_view_config_posttype_{$name}filter has run. Core hooks that filter for several of its own post types and replacesformoutright, so this is only what a post type ends up with when nothing has patched it.It is also reached only for the
postTypekind. Any other$kindstarts from'form' => array(), so a callback for a non-post-type entity builds the whole form itself.To adjust the form for your own post type, patch it on the filter rather than calling this function and re-registering the result:
The
fieldslist merges by member identity, so a new id is appended while an id already present ('excerpt','status', …) is patched in place.The id has to match a field registered for that post type — the editor drops any form entry whose field definition is missing. That is also the reason this default is not gated by
supports: to keep a field out for your post type, leave the correspondingsupportsflag off at registration instead of editing the form.