Repository navigation
fix(faustwp): stop the templates field from changing other nodes' content - #2719
Merged
Merged
Conversation
…tent templates_resolver() removed prepend_attachment from the_content when it found an attachment template, copied from WordPress's template-loader.php. In a GraphQL request that filter was never restored, so a media item's content depended on whether templates had been selected earlier in the query.
josephfusco
marked this pull request as ready for review
November 2, 2026 22:00
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified for the change preserving attachment content filters during template resolution.
No open issues 🎉
What changed in this PR
This PR prevents FaustWP’s GraphQL templates resolver from changing attachment content by removing a side effect on WordPress’s content filters.
Changes:
- Preserve the
prepend_attachmentfilter when an attachment template is found, keeping content consistent whether or nottemplatesis selected. - Add a regression test confirming attachment template resolution leaves the filter registered at priority 10.
| File | Description |
|---|---|
| plugins/faustwp/tests/integration/GraphQLCallbacksTests.php | Adds regression coverage for preserving the attachment content filter. |
| plugins/faustwp/includes/graphql/callbacks.php | Stops template resolution from removing prepend_attachment. |
Review effort: Balanced
colinmurphy
approved these changes
Nov 3, 2026
Merged
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.
Related: wp-graphql/wp-graphql#4575
Media items now always get the attachment markup prepended to
content, which is what already happens whenevertemplatesisn't selected.Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Assisting with reviewing the WPGraphQL node-context compatibility results, making this fix, and writing its test.