Skip to content

Conversation

@westonruter
Copy link
Member

Follow up to #10381 (r61088 / b482707).

See #10381 (comment)

Trac ticket: https://core.trac.wordpress.org/ticket/64126


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@westonruter westonruter requested a review from dmsnell October 31, 2025 18:38
@github-actions
Copy link

github-actions bot commented Oct 31, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props westonruter, dmsnell.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Copy link
Member

@dmsnell dmsnell left a comment

Choose a reason for hiding this comment

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

Without any strong feelings about the names, including the previous one, after stands out more clearly to me than finalized, and I think we can see some natural associations with it based on the way the documentation for the filter is worded.

There is nothing in here that jumps out as issues for concern.

*
* Important: Because this filter is applied inside an output buffer callback (i.e. display handler), any callbacks
* added to the filter must not attempt to start their own output buffers. Otherwise, PHP will raise a fatal error:
* "Cannot use output buffering in output buffering display handlers."
Copy link
Member

Choose a reason for hiding this comment

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

this might be a comment for a discussion outside of this change, but does this stipulation apply to PHP code running inside the template generation too? I know various bits of code that use output buffering for small things, including block themes loading templates via include. If it’s a new default behavior that those snippets will now crash, we should make sure to communicate that in a Dev Note prominently.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, it doesn't apply to PHP code running inside the template generation. Otherwise, this would have been totally infeasible.

Nested output buffers are normal. It's just not allowed to open output buffers inside the callback for handling an output buffer.

@westonruter
Copy link
Member Author

westonruter commented Nov 1, 2025

Without any strong feelings about the names, including the previous one, after stands out more clearly to me than finalized, and I think we can see some natural associations with it based on the way the documentation for the filter is worded.

@dmsnell Do you mean wp_finalized_template_enhancement_output_buffer is fine but you would prefer something that incorporated "after"?

There's wp_after_insert_post, wp_after_execute_ability, wp_after_admin_bar_render, and wp_after_load_template as precedent for that but there should then be a verb added after after, so like wp_after_finalize_template_enhancement_output_buffer? Oof. That's getting long.

Update: Clarified in Slack.

pento pushed a commit that referenced this pull request Nov 1, 2025
…te_enhancement_output_buffer`.

Also update docs for `wp_finalized_template_enhancement_output_buffer` action and `wp_template_enhancement_output_buffer` filter to warn against attempting to open an output buffer in callbacks or else a PHP fatal error will occur.  

Developed in #10443

Follow-up to [61088], [60936].

Props westonruter, dmsnell.
See #43258.
Fixes #64126.


git-svn-id: https://develop.svn.wordpress.org/trunk@61111 602fd350-edb4-49c9-b593-d223f7449a82
@westonruter
Copy link
Member Author

Committed in r61111.

@westonruter westonruter closed this Nov 1, 2025
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Nov 1, 2025
…te_enhancement_output_buffer`.

Also update docs for `wp_finalized_template_enhancement_output_buffer` action and `wp_template_enhancement_output_buffer` filter to warn against attempting to open an output buffer in callbacks or else a PHP fatal error will occur.  

Developed in WordPress/wordpress-develop#10443

Follow-up to [61088], [60936].

Props westonruter, dmsnell.
See #43258.
Fixes #64126.

Built from https://develop.svn.wordpress.org/trunk@61111


git-svn-id: http://core.svn.wordpress.org/trunk@60447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
github-actions bot pushed a commit to platformsh/wordpress-performance that referenced this pull request Nov 1, 2025
…te_enhancement_output_buffer`.

Also update docs for `wp_finalized_template_enhancement_output_buffer` action and `wp_template_enhancement_output_buffer` filter to warn against attempting to open an output buffer in callbacks or else a PHP fatal error will occur.  

Developed in WordPress/wordpress-develop#10443

Follow-up to [61088], [60936].

Props westonruter, dmsnell.
See #43258.
Fixes #64126.

Built from https://develop.svn.wordpress.org/trunk@61111


git-svn-id: https://core.svn.wordpress.org/trunk@60447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.

2 participants