wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
_wp_preload_entity_fields is private and should not be used in themes or plugins directly.
_wp_preload_entity_fields › WordPress Function
Seit7.2.0
Veraltetn/v
› _wp_preload_entity_fields ( $paths, $context )
| Zugriff: |
|
| Parameter: (2) |
|
| Gibt zurück: |
|
| Definiert in: |
|
| 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.Quellcode
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 )
);
}