diff --git a/packages/block-library/src/post-template/edit.js b/packages/block-library/src/post-template/edit.js index b28c726acfc77..a9e279ee2c305 100644 --- a/packages/block-library/src/post-template/edit.js +++ b/packages/block-library/src/post-template/edit.js @@ -100,7 +100,6 @@ export default function PostTemplateEdit( { } = {}, templateSlug, previewPostType, - postType: postTypeFromContext, }, attributes: { layout }, __unstableLayoutClassNames, @@ -187,10 +186,7 @@ export default function PostTemplateEdit( { } // When we preview Query Loop blocks we should prefer the current // block's postType, which is passed through block context. - const usedPostType = - postTypeFromContext && postTypeFromContext !== 'page' - ? postTypeFromContext - : previewPostType || postType; + const usedPostType = previewPostType || postType; return { posts: getEntityRecords( 'postType', usedPostType, { ...query, diff --git a/packages/block-library/src/query/block.json b/packages/block-library/src/query/block.json index 2379a1d1da53c..6ccafc50c8201 100644 --- a/packages/block-library/src/query/block.json +++ b/packages/block-library/src/query/block.json @@ -42,7 +42,7 @@ "default": false } }, - "usesContext": [ "postType", "templateSlug" ], + "usesContext": [ "templateSlug" ], "providesContext": { "queryId": "queryId", "query": "query", diff --git a/packages/block-library/src/query/edit/inspector-controls/index.js b/packages/block-library/src/query/edit/inspector-controls/index.js index bc900c073f648..7d5745e190c9a 100644 --- a/packages/block-library/src/query/edit/inspector-controls/index.js +++ b/packages/block-library/src/query/edit/inspector-controls/index.js @@ -45,15 +45,9 @@ import { useToolsPanelDropdownMenuProps } from '../../../utils/hooks'; const { BlockInfo } = unlock( blockEditorPrivateApis ); export default function QueryInspectorControls( props ) { - const { - attributes, - setQuery, - setDisplayLayout, - postTypeFromContext, - isSingular, - } = props; + const { attributes, setQuery, setDisplayLayout, isSingular } = props; const { query, displayLayout } = attributes; - let { + const { order, orderBy, author: authorIds, @@ -67,16 +61,6 @@ export default function QueryInspectorControls( props ) { parents, format, } = query; - // If a post type is set in context, update `postType` to match it, - // unless the post type is `page`, as it usually doesn't make sense to loop - // through pages. - if ( - postTypeFromContext && - postTypeFromContext !== 'page' && - postTypeFromContext !== postType - ) { - postType = postTypeFromContext; - } const allowedControls = useAllowedControls( attributes ); const showSticky = postType === 'post'; const { diff --git a/packages/block-library/src/query/edit/query-content.js b/packages/block-library/src/query/edit/query-content.js index bdfcbe0498ec4..17eea9337823c 100644 --- a/packages/block-library/src/query/edit/query-content.js +++ b/packages/block-library/src/query/edit/query-content.js @@ -43,7 +43,7 @@ export default function QueryContent( { tagName: TagName = 'div', query: { inherit } = {}, } = attributes; - const { templateSlug, postType } = context; + const { templateSlug } = context; const { isSingular } = getQueryContextFromTemplate( templateSlug ); const { __unstableMarkNextChangeAsNotPersistent } = useDispatch( blockEditorStore ); @@ -159,7 +159,6 @@ export default function QueryContent( { setDisplayLayout={ updateDisplayLayout } setAttributes={ setAttributes } clientId={ clientId } - postTypeFromContext={ postType } isSingular={ isSingular } />