-
Notifications
You must be signed in to change notification settings - Fork 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
Site Editor: template parts not loading on Horizon #48145
Comments
Before Gutenberg v9.5.1 was patched the following logic caused problems with template part loading:
In Gutenberg v9.5.1, David's recent PR modified the logic a bit (see here and here), but the call to I suspect the cause of this issue is still the same. |
Hmm...I've confirmed that the cause is still identical in Gutenberg v9.5.1, but I'm having difficulty getting the rest wp template part query to return the correct data. I've confirmed that the new filter_rest_wp_template_part_query is modifying the query properly. I've also confirmed that the correct template part exists in the database. Can't quite seem to figure out why the correct CPT isn't being returned, even if we're querying the taxonomy theme correctly with the |
After lots of digging into api taxonomy query processing (great bedtime reading 😆 ), it turns out that an invalid taxonomy error was being swallowed. Long story short, the new |
D54315-code should fix the incorrect theme taxonomy registration |
New fix for incorrect theme slug: D54427-code |
Status Update:Ultimately, the issue has been traced to how we query for theme provided template parts. Ex. When themes have a parent directory like so There are three potential solutions in flight: 1. Modify the query made by the Gutenberg clientWith this solution, we use the theme slug from the @wordpress/core-data store for the template parts query. This guarantees that we query by Pros
Cons
2. Modify the query in WPCOM (D54427-code)Use a WordPress hook to intercept all theme taxonomy queries and theme taxonomy assignments to ensure the use of the theme slug's basename (i.e. Pros
Cons
3. Modify the query handled by Gutenberg backend logicEnsure that, when theme provided template parts are initially created, they're always associated with the basename of the theme slug. That is to say, we always assign Pros
Cons
|
A couple thoughts on each approach: for Approach 1 - While the current state of @youknowriad's PR to get rid of auto-drafts makes it hard to distinguish between uncustomized/customized TPs which could make this approach less actionable, he does propose an idea of using the for Approach 2 - Adding another Con - its fragile to different development patterns. If a request is written to retrieve a TP from a specific theme, it works! However, if any request is made for all template parts and is then filtered or analyzed in any other way on the front end there would still be that mismatch between directory/non-directory versions and results will not show up as expected. Also noting this has the same con as 3 - doesn't differentiate between themes of the same name in differing directories (although that may not be a big issue for dotcom specifically). for Approach 3 - this does seem the most simplistic and robust of the noted options. I would note the first con in a different light as well and that is changing/deviating from historical usage of how a theme "id" is represented in WordPress. Since including directories has always been done in the past (and thus allowed for separate themes of identical names), changing it specifically for FSE could open up problems and confusion for folks down the road. |
Interesting point. I'll have to give this more thought. 🤔
Great callout! Totally agree. I'm planning to make a collaborative google doc we can modify together, and I'll be sure to include these points. |
@ianstewart template parts should be loading again on FSE enabled sites for seedlet-blocks and tt1-blocks themes |
Closing this since it works for both themes now. |
After latest Gutenberg plugin updates the template parts are no longer loading on FSE Horizon test flow.
The text was updated successfully, but these errors were encountered: