[wp-meta] [Making WordPress.org] #5818: Theme preview is not working for block themes
Making WordPress.org
noreply at wordpress.org
Thu Sep 9 02:27:01 UTC 2021
#5818: Theme preview is not working for block themes
-----------------------------+---------------------
Reporter: kafleg | Owner: (none)
Type: defect | Status: closed
Priority: high | Milestone:
Component: Theme Directory | Resolution: fixed
Keywords: needs-patch |
-----------------------------+---------------------
Comment (by dd32):
Replying to [comment:7 oandregal]:
> I presume the way wp-themes.com loads the theme fires the `setup_theme`
hook, is that correct?
Yes, `setup_theme` fires on every WordPress pageload, regardless of wp-
themes.com or not.
> We could use that hook to clean the cache. It'd also serve all the use
cases (theme directory, customizer, switch themes programmatically, etc.)
without the overhead of checking for the current theme in every call.
There should be no real overhead in checking for the current theme in
every call, `get_stylesheet()` would be called multiple times, and I
suspect `wp_get_theme()` probably is too.
eg:
{{{#!diff
--- lib/global-styles.php (revision 2595968)
+++ lib/global-styles.php (working copy)
@@ -31,31 +31,31 @@
- get_transient( 'gutenberg_global_styles' );
+ get_transient( get_stylesheet() . '_gutenberg_global_styles' );
}}}
Alternatively, if you can confirm me know which transients are the problem
here, I can update some things. It looks like I might've already done it
though:
https://meta.trac.wordpress.org/browser/sites/trunk/wp-
themes.com/public_html/wp-content/mu-plugins/pub/namespace-transients.php
It looks like I might need to update that to also namespace the
`gutenberg_global_styles` transient too.. which I'll do now..
--
Ticket URL: <https://meta.trac.wordpress.org/ticket/5818#comment:8>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org
More information about the wp-meta
mailing list