-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Context detection for Query block #30369
Copy link
Copy link
Closed
Labels
[Block] Query LoopAffects the Query Loop BlockAffects the Query Loop Block[Feature] Site EditorRelated to the overarching Site Editor (formerly "full site editing")Related to the overarching Site Editor (formerly "full site editing")[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Metadata
Metadata
Assignees
Labels
[Block] Query LoopAffects the Query Loop BlockAffects the Query Loop Block[Feature] Site EditorRelated to the overarching Site Editor (formerly "full site editing")Related to the overarching Site Editor (formerly "full site editing")[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Type
Fields
Give feedbackNo fields configured for Enhancement.
We need to find a way to detect the context a
Queryblock 'lives' and handle any settings needed appropriately. BycontextI mean FSE context (site-editor) or a page/post (post-editor). Moreover is valuable to even know the kind of template we are on FSE context (related: #29438).Noting that we'll also have to take into account what happens when we are in
post-editorand weedit the templatefrom there.There is an
inheritproperty inQuerywhich defaults totrueand with that set, the Query'squeryfor fetching results is inherited from the global query. In a single page there is no much use in having an inherit Query (doesn't fetch anything), but instead a custom one. On the other hand in anarchiveorindextemplate proper results are shown without taking into account any other previously explicitly set options (like the number of posts).Some prior art is here: #27972, where
templateSlugis passed as context and is used for now inQueryLoopto set the properpostTypeif we are in an archive template.