wpseek.com
A WordPress-centric search engine for devs and theme authors
_wp_preload_entity_fields is private and should not be used in themes or plugins directly.
_wp_preload_entity_fields › WordPress Function
Since7.2.0
Deprecatedn/a
› _wp_preload_entity_fields ( $paths, $context )
| Access: |
|
| Parameters: (2) |
|
| Returns: |
|
| Defined at: |
|
| Codex: |
Preloads the fields of the post types the editors list.
The editors read them from the/wp/v2/entity-fields route, see useFields
in packages/editor/src/dataviews/fields-loader/index.ts in Gutenberg. The
post editor reads those of the edited post in the post summary of its
inspector. The site editor reads those of the edited post, if any, and of
the post types of the screen it opens on.Source
function _wp_preload_entity_fields( $paths, $context ) {
$post_types = array();
if ( 'core/edit-post' === $context->name && isset( $context->post ) ) {
$post_types[] = $context->post->post_type;
} elseif ( 'core/edit-site' === $context->name ) {
if ( isset( $context->post ) ) {
$post_types[] = $context->post->post_type;
}
$post_types = array_merge( $post_types, _wp_get_site_editor_screen_post_types() );
}
return array_merge(
$paths,
_wp_get_post_type_fields_preload_paths( $post_types )
);
}