-
Notifications
You must be signed in to change notification settings - Fork 4.8k
[Template Activation] get_block_templates returns edited template as index #71770
Copy link
Copy link
Closed
Closed
Copy link
Labels
[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Description
Since template activation (#67125) the template slug for edited templates is always index. I'm using get_block_templates to retrieve a template.
For "default" template it's correct.
Step-by-step reproduction instructions
- Add this to your
functions.php
add_filter(
'get_block_templates',
function ( $templates ) {
array_map(
function ( $template ) {
do_action( 'qm/debug', $template->slug ); // use any method to log data
},
$templates
);
return $templates;
},
10,
1
);
- Go to some page on the frontend that uses default template (e.g. 404)
- ->
404(or whatever you chosen) - Go to Editor > Templates
- Duplicate some template and make it active
- Visit the page on the frontend
- ->
index
The same goes for title, id, etc.
The issue has significant impact on WooCommerce templates logic causing among others this problem: woocommerce/woocommerce#61032
Screenshots, screen recording, code snippet
Logged:
- slug
- id
- title
| "Default" template | "Edited" template |
|---|---|
![]() |
![]() |
Environment info
- WordPress 6.8
- Gutenberg 21.7RC
- WooCommerce 10.3-dev
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
Please confirm which theme type you used for testing.
- Block
- Classic
- Hybrid (e.g. classic with theme.json)
- Not sure
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Type
Fields
Give feedbackNo fields configured for issues without a type.

