Read a missing query inherit key as not inherited - #58
Merged
Conversation
The post type filter reads `$block->context['query']['inherit']` directly. The query block's own attribute default carries the key, but markup that names a `query` object without it — hand written patterns, third party query blocks — reaches render with the key absent, and every render of the filter raises "Undefined array key \"inherit\"" twice. Read it through empty(), as the taxonomy filter already does, and reuse the result for the inherited post type fill-in below. The test mu-plugin now records notices raised from this plugin's own files and prints them into the page, so a spec can assert a page rendered cleanly without depending on how the environment displays errors. Fixture page 4 carries a query loop whose context omits `inherit`. Fixes #15 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lj871x28S1DXjoVm7AB4k5
Playwright — PHP 8.3 / WP latestDetails
|
roborourke
marked this pull request as ready for review
September 2, 2026 11:39
…-fixes-07a61k-issue-15 # Conflicts: # tests/e2e/README.md # tests/seed.php
…-fixes-07a61k-issue-15
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.
Fixes #15.
Reproduced
A query loop whose
queryattribute names an object withoutinherit(hand-written pattern markup, third-party query blocks — the object attribute is used as authored, so the block type's default is not merged in) renders the post type filter twice per request, and each render raises the notice:Verified against WordPress 6.8.8 and 7.0.4 with Twenty Twenty-Five. The taxonomy filter named in the issue was fixed earlier; the same read survived in the post type filter.
Changes
src/post-type/render.phpreadsinheritthroughempty()once, into$inherit, and reuses it for the inherited post type fill-in further down.tests/mu-plugins/register-test-content.phprecords PHP notices raised from this plugin's own files and prints them as<!-- qf-php-error: … -->, followed by aqf-php-errors-checkedmarker. A page's cleanliness is then assertable without depending on the environment'sdisplay_errors— a warning does not reach the response under every SAPI.tests/seed.phpadds fixture page 4,/no-inherit-context/: both filters in a query loop whose context omitsinherit.tests/e2e/query-context.spec.jsasserts that page renders no plugin notice and that the filters still narrow the loop.Verification
The new spec fails on
main(qf-php-error: Undefined array key "inherit" in post-type/render.php:13) and passes with the fix. Full suite: 22 passed on WP 6.8.8 and 7.0.4.composer phpcsclean on the changed PHP.🤖 Generated with Claude Code
https://claude.ai/code/session_01Lj871x28S1DXjoVm7AB4k5
Generated by Claude Code