Skip to content

Add "Curated Posts" control to set the query "include" parameter#15

Open
goldenapples wants to merge 2 commits into
mainfrom
curated-posts-control
Open

Add "Curated Posts" control to set the query "include" parameter#15
goldenapples wants to merge 2 commits into
mainfrom
curated-posts-control

Conversation

@goldenapples

Copy link
Copy Markdown

Adds a new "Curated Posts" panel in the editor to search for, select, and reorder curated posts for a query loop. This overrides any other query filters or parameters set.

Adds a new "Curated Posts" panel in the editor to search for, select,
and reorder curated posts for a query loop. This overrides any other
query filters or parameters set.
@github-actions

Copy link
Copy Markdown

Playwright test results

passed  16 passed

Details

stats  16 tests across 5 suites
duration  54.4 seconds
commit  92956b5

@kadamwhite kadamwhite left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This plugin's getting more and more complex. Love it, but took a bit to reason through! Think this is a ✅ from me overall, but I'm not certain about the "any" handling or the purported search fallback in getEntity Records.

/**
* Resolve a list of post IDs to lightweight {id, title, type} records via the
* `core` data store. Scoped to the query's post type when known so we use the
* right REST entity; falls back to the search endpoint for mixed/unknown types.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this search fallback logic, is this comment outdated, or is that behavior triggered by passing any to getEntityRecords?

}, [ records ] );

const setInclude = ( nextIds ) => {
const { include: _omit, orderBy: _omitOrder, ...rest } = query || {};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we explicitly strip the orderBy here? I get that we overwrite it at the end to include, but I'm surprised we'd remove it from play first.

// Resolve the post type's REST base so the search hits the right endpoint.
const restBase = useSelect(
( select ) => {
const type = postType && postType !== 'any' ? postType : 'post';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this sets post when you pass any, assume that's intentional? This wouldn't seem to actually handle "any," in the way I'd interpret it...?

Note to self, build_query_vars_from_query_block will fall back to post so this is consistent.

@mattheu

mattheu commented Jun 8, 2026

Copy link
Copy Markdown
Member

I've not tested/reviewed the code, but love it as this is such a common requirement. However we've been using it in conjunction with the Advanced Query Loop plugin, which supports this functionality. Could this conflict?

@mattheu mattheu mentioned this pull request Jun 8, 2026
@roborourke

Copy link
Copy Markdown
Collaborator

This is duplicating #12 I think, and is encroaching on what the Advanced Query Loop plugin provides so not something I think needs to be part of this plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants