WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.57k stars 4.22k forks source link

Wrong template displayed for hybrid themes in the post template editor #64341

Open jffng opened 3 months ago

jffng commented 3 months ago

Description

The post template editor shows the wrong template for hybrid themes that contain a mix of block and php templates.

Step-by-step reproduction instructions

  1. Activate a classic theme that has a single.php or page.php (e.g. twentytwentyone)
  2. Add a templates/index.html file.
  3. Go to add / edit a post or page.
  4. Verify the template editor renders the index.html, instead of single.php.
  5. Verify the front-end renders the single.php.

Screenshots, screen recording, code snippet

https://github.com/user-attachments/assets/7234ddf6-892a-4428-98bb-015d4c5eaff1

Environment info

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

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

carlomanf commented 3 months ago

I think these may be related and/or duplicate issues: #31633 #63124 #64303

youknowriad commented 1 week ago

I think we should disable template previews and template editing for hybrid themes unless we're certain that the associated template is a block template one.

carolinan commented 5 days ago

I tried looking into this today but was not able to get any closer to solving it.