Skip to content

Template part file path is no longer passed to the render_block_core_template_part_file action #56013

@johnbillion

Description

@johnbillion

Description

In #52892 the render method of the Template Part block was changed to use get_block_file_template(). As a result, assignment to the $template_part_file_path variable was removed, which means the template part file path is no longer passed to the render_block_core_template_part_file action. An empty string is passed instead.

The bug has been present in WordPress core since 6.3.

Step-by-step reproduction instructions

This bug can be observed by using the following code:

add_action( 'render_block_core_template_part_file', function( $template_part_id, $attributes, $template_part_file_path ) {
    var_dump( $template_part_file_path );
}, 10, 3 );

Load the front page of a vanilla WordPress site using the Twenty Twenty Four theme and observe that only empty strings get logged, instead of the template part file path.

This bug can also be observed by installing the Query Monitor plugin and viewing the "Template" panel, which up until 6.3 showed the path to each Template Part block that was loaded on the page. This now shows no data for template parts loaded by the Template Part block.

Screenshots, screen recording, code snippet

No response

Environment info

  • WordPress core 6.3 or later

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

Labels

[Feature] Templates APIRelated to API powering block template functionality in the Site Editor[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions