From 1e0a3cf8af11772bf4aefa9c8704e94393a1d1e8 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Mon, 17 Jan 2022 09:31:08 +0100 Subject: [PATCH] Load the entities list using the view context (#37685) --- packages/core-data/src/entities.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core-data/src/entities.js b/packages/core-data/src/entities.js index 426745ce1b3cf..5d8256699db38 100644 --- a/packages/core-data/src/entities.js +++ b/packages/core-data/src/entities.js @@ -205,7 +205,7 @@ export const prePersistPostType = ( persistedRecord, edits ) => { * @return {Promise} Entities promise */ async function loadPostTypeEntities() { - const postTypes = await apiFetch( { path: '/wp/v2/types?context=edit' } ); + const postTypes = await apiFetch( { path: '/wp/v2/types?context=view' } ); return map( postTypes, ( postType, name ) => { const isTemplate = [ 'wp_template', 'wp_template_part' ].includes( name @@ -216,7 +216,7 @@ async function loadPostTypeEntities() { baseURL: `/${ namespace }/${ postType.rest_base }`, baseURLParams: { context: 'edit' }, name, - label: postType.labels.singular_name, + label: postType.name, transientEdits: { blocks: true, selection: true, @@ -240,7 +240,7 @@ async function loadPostTypeEntities() { */ async function loadTaxonomyEntities() { const taxonomies = await apiFetch( { - path: '/wp/v2/taxonomies?context=edit', + path: '/wp/v2/taxonomies?context=view', } ); return map( taxonomies, ( taxonomy, name ) => { const namespace = taxonomy?.rest_namespace ?? 'wp/v2'; @@ -249,7 +249,7 @@ async function loadTaxonomyEntities() { baseURL: `/${ namespace }/${ taxonomy.rest_base }`, baseURLParams: { context: 'edit' }, name, - label: taxonomy.labels.singular_name, + label: taxonomy.name, }; } ); }