--- a/wp/wp-includes/class-wp-theme.php Fri Sep 05 18:40:08 2025 +0200
+++ b/wp/wp-includes/class-wp-theme.php Fri Sep 05 18:52:52 2025 +0200
@@ -60,6 +60,7 @@
* @since 5.9.0 Added the Twenty Twenty-Two theme.
* @since 6.1.0 Added the Twenty Twenty-Three theme.
* @since 6.4.0 Added the Twenty Twenty-Four theme.
+ * @since 6.7.0 Added the Twenty Twenty-Five theme.
* @var string[]
*/
private static $default_themes = array(
@@ -79,6 +80,7 @@
'twentytwentytwo' => 'Twenty Twenty-Two',
'twentytwentythree' => 'Twenty Twenty-Three',
'twentytwentyfour' => 'Twenty Twenty-Four',
+ 'twentytwentyfive' => 'Twenty Twenty-Five',
);
/**
@@ -240,7 +242,7 @@
*
* @since 3.4.0
*
- * @global array $wp_theme_directories
+ * @global string[] $wp_theme_directories
*
* @param string $theme_dir Directory of the theme within the theme_root.
* @param string $theme_root Theme root.
@@ -1757,11 +1759,11 @@
// Set the option so we never have to go through this pain again.
if ( is_admin() && $allowed_themes[ $blog_id ] ) {
if ( $current ) {
- update_option( 'allowedthemes', $allowed_themes[ $blog_id ] );
+ update_option( 'allowedthemes', $allowed_themes[ $blog_id ], false );
delete_option( 'allowed_themes' );
} else {
switch_to_blog( $blog_id );
- update_option( 'allowedthemes', $allowed_themes[ $blog_id ] );
+ update_option( 'allowedthemes', $allowed_themes[ $blog_id ], false );
delete_option( 'allowed_themes' );
restore_current_blog();
}
@@ -1846,7 +1848,7 @@
$this->delete_pattern_cache();
}
- $dirpath = $this->get_stylesheet_directory() . '/patterns/';
+ $dirpath = $this->get_stylesheet_directory() . '/patterns';
$pattern_data = array();
if ( ! file_exists( $dirpath ) ) {
@@ -1855,7 +1857,21 @@
}
return $pattern_data;
}
- $files = glob( $dirpath . '*.php' );
+
+ $files = (array) self::scandir( $dirpath, 'php', -1 );
+
+ /**
+ * Filters list of block pattern files for a theme.
+ *
+ * @since 6.8.0
+ *
+ * @param array $files Array of theme files found within `patterns` directory.
+ * @param string $dirpath Path of theme `patterns` directory being scanned.
+ */
+ $files = apply_filters( 'theme_block_pattern_files', $files, $dirpath );
+
+ $dirpath = trailingslashit( $dirpath );
+
if ( ! $files ) {
if ( $can_use_cached ) {
$this->set_pattern_cache( $pattern_data );