Skip to content

Commit

Permalink
Load the entities list using the view context (#37685)
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Jan 17, 2022
1 parent adb5e50 commit 1e0a3cf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/core-data/src/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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';
Expand All @@ -249,7 +249,7 @@ async function loadTaxonomyEntities() {
baseURL: `/${ namespace }/${ taxonomy.rest_base }`,
baseURLParams: { context: 'edit' },
name,
label: taxonomy.labels.singular_name,
label: taxonomy.name,
};
} );
}
Expand Down

0 comments on commit 1e0a3cf

Please sign in to comment.