Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An incorrect template part slugs when the theme folder name ends with parts #42679

Open
Mamaduka opened this issue Jul 25, 2022 · 0 comments
Open
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Type] Bug An existing feature does not function as intended

Comments

@Mamaduka
Copy link
Member

Description

I noticed while working on #37943.

The _get_block_templates_files generates template name slugs that include directory names when the theme name ends with parts. As a result, it causes REST API requests to fail and prevents saving the changes.

I think the following lines are the cause of the issue - https://github.com/WordPress/wordpress-develop/blob/6.0/src/wp-includes/block-template-utils.php#L316-L322.

Step-by-step reproduction instructions

  1. Create a child theme using WP-CLI
wp scaffold child-theme auto-parts --parent_theme=twentytwentytwo --theme_name="Auto Parts"
  1. Copy the parts directory from the parent theme.
cp -r wp-content/themes/twentytwentytwo/parts wp-content/themes/auto-parts/parts
  1. Go to the Site Editor -> Template Parts
  2. Confirm that template part slugs contain the directory name.

Screenshots, screen recording, code snippet

CleanShot 2022-07-25 at 19 57 15

Environment info

WP 6.0.x with or without the Gutenberg plugin.

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

@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. labels Jul 25, 2022
@Mamaduka Mamaduka changed the title The incorrect template part slugs when the theme folder name ends parts The incorrect template part slugs when the theme folder name ends with parts Jul 25, 2022
@Mamaduka Mamaduka changed the title The incorrect template part slugs when the theme folder name ends with parts An incorrect template part slugs when the theme folder name ends with parts Jul 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

1 participant