-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Template part has been deleted or is unavailable #44243
Comments
@MaggieCabrera any insight here based on your prior comments on a related issue? Also, @janboddez thanks for opening! Can you confirm whether this happens with other block themes other than the Bjork one? |
Tried another theme by the same author (Poe) and this time it seems to be only the "loop" block that's "unavailable." Also tried with a child theme of Blockbase and that seems to work fine, for now (just had a quick glance at a few templates, nothing seemed off). Did all of this on a different site than the first one, just in case. So it might be a theme issue, but I don't see anything odd about how template parts are defined in I also noticed that if I go and edit the Template Part itself, it's all there, as it should (even with the child theme active). |
Hmm by chance, have you tried using this plugin to create a child theme instead? https://wordpress.org/plugins/create-block-theme/ Perhaps @jffng has some insight here :) |
Just did, same result. |
Can confirm @janboddez report. Used the plugin to create child theme and get same error with Björk. |
TL;DR Some details: In the original theme's
The one above works OK. These two, however, error out:
See how they explicitly mention Found out by adding a couple debug statements to the template REST API endpoint. The first template part above (so without explicit mention of the parent theme) ends up getting an ID of |
Left a message on the WP.org support forum, too: https://wordpress.org/support/topic/child-theme-and-template-parts-issue/ Not closing the issue, yet, as it could still be caused by theme creation tooling or whatnot. |
I fixed this in Björk (and in my other block themes) by removing I couldn't find any documentation for the |
Cool! I do agree that either WP should be more robust for this, or the documentation improved (or both). |
cc @DaisyOlsen and @justintadlock on the documentation front! |
Help us move this issue forward. This issue is being marked stale since it has no activity after 15 days of requesting more information. Please add info requested so we can help move the issue forward. Note: The triage policy is to close stale issues that need more info and no response after 2 weeks. |
Experienced this as well with https://wordpress.org/themes/raft/ by themeislel, Suggestion of @andersnoren to change
to
in |
Help us move this issue forward. This issue is being marked stale since it has no activity after 15 days of requesting more information. Please add info requested so we can help move the issue forward. Note: The triage policy is to close stale issues that need more info and no response after 2 weeks. |
The issue was recently raised in forums for this plugin, and the issue was reported here @matiasbenedetto fixed this 🎊 @janboddez can you please check your site if child themes created with the Create Block Plugin are still returning the error? The issue has been marked as stale and will likely close soon. |
Then there are (were?) two issues:
|
I made some testing about the template-part loading and this is what I found. I could reproduce the issue (Template part has been deleted or is unavailable) ONLY when the template part is linked from a pattern. The problem can be reproduced in both stand-alone/parent themes, and child themes. Option working as expected:To avoid this problem you need to add the
I'm not sure if this was designed to work like this but by doing that I was able to avoid the problem. About this issue Create Block Theme PluginExporting stand-alone/parent themes works as expected. Extra Info:If the template part is linked from a template and not from a pattern it works seamlessly no matter if you add the theme key in the link or not.
☝️ These 3 options are working as expected when you link a template-part from a template (not from a pattern). Steps to reproduce the issue:If you want to reproduce the error loading template-parts linked from a pattern you can do something like this:
I tested using:
|
As far as I can tell this issue is not specifically related to neither patterns nor the Create Block Theme plugin. From my experience whenever you use the site editor to make changes to a parent theme it will add theme key/themeslug to the wp:template-part html-comment in parent theme templates, and this will in my experience break the child theme. To recreate the issue in it’s simplest form I have tried with these steps.
I tested using
No other plugins installed |
Not sure what happened here; I purposely left out the Edit: It may very well be due to the fact that my site seems to have upgraded to 6.4 beta 😅 |
I followed this comment and tested to see if the problem still occurs. This problem doesn't seem to reproduce in my environment, but how about your environment? I tested using
The template part now had the parent theme's slug:
Here, the theme slug was automatically changed to the child theme:
Before updating the template, the theme slug had changed to that of the parent:
Here the theme slug was automatically updated to that of the child theme and no error occurred:
Here I got the opposite result. If the theme slug was missing, a "Template part has been deleted or is unavailable: header" error occurred. However, this step should not be necessary since the expected results are obtained up to step 15. |
… or is unavailable: header" - Caused by issue in WordPress/gutenberg#44243
… or is unavailable: header" - Caused by issue in WordPress/gutenberg#44243
I tested it again on WP6.5 Beta3, and the results are exactly the same as this comment, and the problem appears to be completely resolved. I'd like to close this issue, but if I've missed anything, please feel free to comment. |
My custom block theme keeps inserting
This results in the error: "Template part has been deleted or is unavailable." I'm unsure about the steps required to avoid this issue. I also suspect the Create Block Theme plugin might not be working correctly. It generates a child theme using API version 3, whereas my parent theme uses API version 2. Additionally, it doesn't create the single.html template, which I expect it to generate. PS in theme.json file of the parent theme I have this code:
in parts folder of parent theme I have this file
When I create child theme with Create Block Theme plugin, this results in the error: "Template part has been deleted or is unavailable." on this block |
Description
I've been working on a Twenty Twenty-Two child theme and it's been great.
I then tried to do the same (create a child theme) for Anders Norén's Björk, but the site's broken and the Editor shows a bunch of 'Template part has been deleted or is unavailable' errors.
debug.log
shows errors like these:Tried installing the Gutenberg plugin, but alas. (The TT2 child theme works great even without it.)
Found WordPress/create-block-theme#27 and https://core.trac.wordpress.org/ticket/54507 but they both seem solved, so I think something else might be going on.
Step-by-step reproduction instructions
Install Björk. Create (nearly) blank child theme. Like, just a
style.css
with the necessary information in it.Activate it. Visit site, or Site Editor. You'll see missing block (part) templates.
Expect everything to just work as if the parent theme was active. As has been my experience with (a child theme of) TT2, luckily.
Screenshots, screen recording, code snippet
No response
Environment info
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
The text was updated successfully, but these errors were encountered: