Run the full query generator on inherited queries (archive query inheritance) - #176
Open
ryanwelcher wants to merge 7 commits into
Open
ryanwelcher wants to merge 7 commits into
ryanwelcher wants to merge 7 commits into
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C2rJj83EMLAfKhtwLCGxdP
Replace the hand-merge of three keys (perPage/order/orderBy) with the full Query_Params_Generator pipeline, enabling all AQL traits to work on inherited queries. The aql_query_vars filter now receives fully processed args when inherit=true, not just hardcoded values. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C2rJj83EMLAfKhtwLCGxdP
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C2rJj83EMLAfKhtwLCGxdP
Add blueprint seeding for a category archive with meta-ordered inherited AQL queries (filtering, ordering, pagination) and an editor spec covering the inherit-mode advanced control panels. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C2rJj83EMLAfKhtwLCGxdP
As of version 4.5.0, inherited queries now support the full set of advanced controls (meta queries, tax queries, date queries, and ordering) on top of an archive template's query. Document the richer payload in the aql_query_vars filter and note the limitation regarding Items per page pagination on deeper archive pages. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C2rJj83EMLAfKhtwLCGxdP
The inherit branch of pre_render_block ran the full Query_Params_Generator over a block_query attribute that could still carry include_posts, multiple_posts, or exclude_current from before the block was switched to inherit. include_posts/multiple_posts corrupt the archive's post__in / post_type, and exclude_current falls back to get_queried_object_id(), which on a taxonomy archive returns a term ID, not a post ID, causing an arbitrary post to be excluded. Unset the three params before generating inherited query args, and hide the "Exclude current post" control in the editor's inherit mode (join additional_post_types/include_posts, which were already hidden). Also fixes a stray 4th @PARAM line on the aql_query_vars docblock in the same file, and corrects/expands the extending-aql.md docs: the old $inherited payload always received the full inherited main-query vars (only posts_per_page/order/orderby from the block were layered on top, not the other way around), and notes that AQL caching on an inherited search template creates a transient per unique search string/page. Adds two generator-level unit tests mirroring the unset contract, since query-loop.php can't be loaded by PHPUnit. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C2rJj83EMLAfKhtwLCGxdP
Resolves the readme.txt changelog conflict (trunk renamed the unreleased block to 5.0.0) and relabels this branch's 4.5.0 references to 5.0.0 to match the release prep on trunk. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C2rJj83EMLAfKhtwLCGxdP
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
It changes main-query inheritance behavior across PHP and editor UI with broad runtime impact, so a final human review is warranted despite strong test coverage.
Pull request overview
This PR extends Advanced Query Loop’s inherited Query Loop behavior (query.inherit: true) so inherited (archive) queries are processed through the full Query_Params_Generator, allowing AQL’s advanced filters and ordering to layer on top of the archive’s existing context instead of being ignored.
Changes:
- Add
Query_Params_Generator::get_inherited_query_args()and update the inherit branch inpre_render_blockto generate + merge full inherited args (and strip stale context-overriding block params). - Update editor inherit-mode UI to expose the advanced AQL control groups (with a reduced allowed-controls set) and remove “inherit-only” gating in ordering controls.
- Add PHPUnit + Playwright coverage plus blueprint seeding to verify archive term filtering + meta ordering + pagination, and document inherit-mode limitations/behavior.
File summaries
| File | Description |
|---|---|
| tests/unit/Inherited_Query_Args_Tests.php | Adds unit tests validating inherited-query arg merging, normalization, and prevention of context leakage. |
| tests/e2e/tests/inherited-query.spec.ts | Adds E2E coverage for archive term filtering + meta ordering + pagination and for inherit-mode editor panels. |
| src/variations/controls.js | Exposes advanced panels in inherit mode while filtering out context-overriding controls; adds an editor-preview limitation notice. |
| src/groups/order.js | Enables secondary sort UI in inherit mode (removes previous inherit gating). |
| src/components/post-order-controls.js | Enables meta-key ordering UI in inherit mode (removes previous inherit gating). |
| readme.txt | Documents full inherit-mode support plus the perPage vs Reading setting 404 limitation. |
| readme.md | Adds 5.0.0 changelog entry describing inherit-mode behavior and limitation. |
| includes/query-loop.php | Runs the full query generator for inherited queries, strips stale override params, and passes processed args to aql_query_vars. |
| includes/Query_Params_Generator.php | Introduces get_inherited_query_args() to merge inherited vars + core perPage/order + trait-generated args. |
| extending-aql.md | Documents updated inherited-mode aql_query_vars behavior and notes caching/transient implications. |
| _blueprints/e2e-blueprint.json | Seeds categories + meta and adjusts Reading pagination for deterministic inherited-archive E2E coverage. |
Review details
- Files reviewed: 11/11 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Inherited Query Loop queries (
query.inherit: true) now run the fullQuery_Params_Generator, so the advanced controls — meta queries, taxonomy queries, date queries, multi-property ordering, caching, and more — layer on top of the archive's own query instead of being silently ignored. The editor exposes the advanced control groups in inherit mode, minus the controls that would override the archive context (additional_post_types,include_posts,exclude_current_post).Fixes the recurring taxonomy-archive complaint, most recently: https://wordpress.org/support/topic/aql-in-taxonomy-archive/ — a taxonomy archive template can now keep its term filtering while sorting by a meta value.
How
includes/query-loop.php+ newQuery_Params_Generator::get_inherited_query_args()): the inherit branch ofpre_render_blockruns the generator over$wp_query->query_varsand merges, instead of hand-copyingperPage/order/orderBy. Stale context-overriding attributes (include_posts,multiple_posts,exclude_current) saved before a block was switched to inherit are stripped server-side.aql_query_varskeeps its signature; with$inherited = trueit now receives the fully processed args (documented inextending-aql.md).src/variations/controls.js): inherit mode renders the same control groups as custom mode, gated by a filteredallowedControlslist, plus an info notice that archive previews can't reflect the specific term being viewed. Two stale!inheritgates in the order controls were lifted.perPage/order/orderByequivalence,id → IDnormalization, no leakage of stripped params); new Playwright spec covering term filtering + meta ordering, archive pagination, and the inherit-mode editor panels, with blueprint seeding designed so meta order is provably distinct from date order.extending-aql.mdand both readmes, including a documented limitation — with inherit on, a block Items-per-page lower than Settings → Reading can 404 deeper archive pages because core evaluates main-query pagination before the block runs.Includes a merge of latest
trunk(5.0.0 release prep); version references follow suit.Testing
npm run test:unit: 173/173 passingnpm run test:e2e: 33/33 passing (includes the 3 new inherited-query tests)npm run lint:php,npm run build: clean🤖 Generated with Claude Code
https://claude.ai/code/session_01C2rJj83EMLAfKhtwLCGxdP