Themes: Fix caching issue in get_post_templates method in `WP_Theme`.
Fix an edge case caching issue, where if a developer use the `wp_cache_themes_persistently` filter and is running the site in multisite configuration, it meant block template are incorrectly cached. Block templates are stored in the posts table. But in a multisite configuration, different sites on the multisite could have different block templates stored in there post table. As themes cache group is a global group, it resulted in incorrect values being cached. Props maniu, spacedmonkey, hellofromTonya, oglekler, mukesh27, joemcgill. Fixes #57886. Built from https://develop.svn.wordpress.org/trunk@55939 git-svn-id: http://core.svn.wordpress.org/trunk@55451 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3d94d17402
commit
dac560b77d
|
@ -1283,6 +1283,9 @@ final class WP_Theme implements ArrayAccess {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->cache_add( 'post_templates', $post_templates );
|
||||||
|
}
|
||||||
|
|
||||||
if ( current_theme_supports( 'block-templates' ) ) {
|
if ( current_theme_supports( 'block-templates' ) ) {
|
||||||
$block_templates = get_block_templates( array(), 'wp_template' );
|
$block_templates = get_block_templates( array(), 'wp_template' );
|
||||||
foreach ( get_post_types( array( 'public' => true ) ) as $type ) {
|
foreach ( get_post_types( array( 'public' => true ) ) as $type ) {
|
||||||
|
@ -1300,9 +1303,6 @@ final class WP_Theme implements ArrayAccess {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->cache_add( 'post_templates', $post_templates );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $this->load_textdomain() ) {
|
if ( $this->load_textdomain() ) {
|
||||||
foreach ( $post_templates as &$post_type ) {
|
foreach ( $post_templates as &$post_type ) {
|
||||||
foreach ( $post_type as &$post_template ) {
|
foreach ( $post_type as &$post_template ) {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.3-alpha-55938';
|
$wp_version = '6.3-alpha-55939';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue