From cfd770854c6f53e920613f18b37e153301cea2db Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Tue, 12 May 2020 15:26:56 +0200 Subject: [PATCH] Add required query args --- .../src/components/template-switcher/index.js | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/packages/edit-site/src/components/template-switcher/index.js b/packages/edit-site/src/components/template-switcher/index.js index e0fff1222befb8..a8fd6caa3a8572 100644 --- a/packages/edit-site/src/components/template-switcher/index.js +++ b/packages/edit-site/src/components/template-switcher/index.js @@ -71,21 +71,25 @@ export default function TemplateSwitcher( { const { getCurrentTheme, getEntityRecords } = select( 'core' ); return { currentTheme: getCurrentTheme(), - templates: getEntityRecords( 'postType', 'wp_template' )?.map( - ( template ) => ( { - label: ( - - ), - value: template.id, - slug: template.slug, - } ) - ), + templates: getEntityRecords( 'postType', 'wp_template', { + resolved: true, + } )?.map( ( template ) => ( { + label: ( + + ), + value: template.id, + slug: template.slug, + } ) ), templateParts: getEntityRecords( 'postType', - 'wp_template_part' + 'wp_template_part', + { + status: [ 'publish', 'auto-draft' ], + theme: getCurrentTheme()?.stylesheet, + } )?.map( ( templatePart ) => ( { label: , value: templatePart.id,