Skip to content

fix(faustwp): stop the templates field from changing other nodes' content - #2719

Merged
josephfusco merged 4 commits into
canaryfrom
fix/templates-prepend-attachment-leak
Nov 3, 2026
Merged

josephfusco merged 4 commits into
canaryfrom
fix/templates-prepend-attachment-leak

Conversation

@josephfusco

@josephfusco josephfusco commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Related: wp-graphql/wp-graphql#4575

Media items now always get the attachment markup prepended to content, which is what already happens whenever templates isn'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.

…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 josephfusco added [Type] Bug An existing feature is broken [Area] WordPress Plugin Issues for the Faust.js WordPress plugin labels Nov 2, 2026
@josephfusco
josephfusco marked this pull request as ready for review November 2, 2026 22:00
@josephfusco
josephfusco requested review from a team and colinmurphy as code owners November 2, 2026 22:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 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_attachment filter when an attachment template is found, keeping content consistent whether or not templates is 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

@josephfusco
josephfusco merged commit 9303677 into canary Nov 3, 2026
13 checks passed
@josephfusco
josephfusco deleted the fix/templates-prepend-attachment-leak branch November 3, 2026 15:53
@github-actions github-actions Bot mentioned this pull request Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Area] WordPress Plugin Issues for the Faust.js WordPress plugin [Type] Bug An existing feature is broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants