Skip to content

Conversation

Adi-ty
Copy link

@Adi-ty Adi-ty commented Aug 11, 2025

This PR fixes an inconsistency where block hooks were not being applied to templates registered by plugins using register_block_template().

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


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.

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.

@Adi-ty Adi-ty marked this pull request as ready for review August 12, 2025 06:00
Copy link

github-actions bot commented Aug 12, 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 iamadisingh, aljullu, bernhard-reiter.

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

@Adi-ty Adi-ty force-pushed the fix/plugin-template-block-hooks branch from bbed6bd to cbc1205 Compare August 14, 2025 17:03
Copy link

@Aljullu Aljullu left a comment

Choose a reason for hiding this comment

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

Thanks for working on this, @Adi-ty! I tested with the testing steps from WordPress/gutenberg#71139 and I can confirm that:

  1. In the frontend, the template from the plugin correctly displays the hooks:
Before After
imatge imatge
  1. When making a request to /wp-json/wp/v2/templates/twentytwentyfive//plugin-template, the template in the response now has the hooks applied to the content.
Before After
imatge imatge
  1. That is not a problem when accessing the template in the site editor (ie: /wp-admin/site-editor.php?canvas=edit&p=%2Fwp_template%2Ftwentytwentyfive%2F%2Fplugin-template). Hooks are still rendered only once.

I'm approving from my side, but I don't have permisions in WP core. @ockham wondering if you (or somebody you know) can help us move this forward?

@Adi-ty
Copy link
Author

Adi-ty commented Aug 15, 2025

Thanks for working on this, @Adi-ty! I tested with the testing steps from WordPress/gutenberg#71139 and I can confirm that:

  1. In the frontend, the template from the plugin correctly displays the hooks:

Before After
imatge imatge
2. When making a request to /wp-json/wp/v2/templates/twentytwentyfive//plugin-template, the template in the response now has the hooks applied to the content.

Before After
imatge imatge
3. That is not a problem when accessing the template in the site editor (ie: /wp-admin/site-editor.php?canvas=edit&p=%2Fwp_template%2Ftwentytwentyfive%2F%2Fplugin-template). Hooks are still rendered only once.

I'm approving from my side, but I don't have permisions in WP core. @ockham wondering if you (or somebody you know) can help us move this forward?

Thanks for testing and confirming the changes. Hopefully we can get this moved forward soon.

@ockham
Copy link
Contributor

ockham commented Aug 28, 2025

Thank you both! I'll go ahead and commit this 👍

Copy link

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 60688
GitHub commit: 7158d9f

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

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.

3 participants