wpseek.com
A WordPress-centric search engine for devs and theme authors
wp_register_core_field_collections › WordPress Function
Since7.2.0
Deprecatedn/a
› wp_register_core_field_collections ( No parameters )
| Defined at: | |
| Codex: |
Registers the fields of WordPress core: the defaults first, without the ones the core post types do not get, then the collections of single post types, then the collection of the site.
Hooked at priority 0, so a plugin hookingwp_entity_fields_api_init at the
default priority sees the core fields registered, and can update or
unregister them.Source
function wp_register_core_field_collections() {
// Defaults registered for all post types based on their supports.
wp_register_core_post_type_supports_fields();
// page: unregister unwanted default fields, and register its own.
wp_unregister_entity_fields( 'postType', 'page', array( 'title' ) );
wp_register_entity_field_collection( __DIR__ . '/page' );
// wp_template: unregister unwanted default fields, and register its own.
wp_unregister_entity_fields( 'postType', 'wp_template', array( 'author', 'date', 'excerpt', 'password', 'post-content-info', 'scheduled_date', 'slug', 'status', 'template', 'title' ) );
wp_register_entity_field_collection( __DIR__ . '/wp_template' );
// wp_template_part: unregister unwanted default fields, and register its own.
wp_unregister_entity_fields( 'postType', 'wp_template_part', array( 'author', 'date', 'excerpt', 'password', 'post-content-info', 'scheduled_date', 'slug', 'status', 'template', 'title' ) );
wp_register_entity_field_collection( __DIR__ . '/wp_template_part' );
// wp_block: unregister unwanted default fields, and register its own.
wp_unregister_entity_fields( 'postType', 'wp_block', array( 'date', 'excerpt', 'password', 'scheduled_date', 'slug', 'status', 'template', 'title' ) );
wp_register_entity_field_collection( __DIR__ . '/wp_block' );
// Patterns are sorted client-side, where the author's ID isn't a useful
// order, like the template authors.
if ( post_type_supports( 'wp_block', 'author' ) ) {
wp_update_entity_fields(
'core',
'postType',
'wp_block',
array(
array(
'id' => 'author',
'enableSorting' => false,
),
)
);
}
// attachment: unregister all default fields, and register its own.
wp_unregister_entity_fields( 'postType', 'attachment' );
wp_register_entity_field_collection( __DIR__ . '/attachment' );
// wp_navigation: unregister unwanted default fields.
wp_unregister_entity_fields( 'postType', 'wp_navigation', array( 'date', 'password', 'post-content-info', 'scheduled_date', 'slug', 'status', 'template' ) );
// Register fields for root/site (entity/kind).
wp_register_entity_field_collection( __DIR__ . '/root_site' );
}