diff --git a/wp-includes/class-wp-theme.php b/wp-includes/class-wp-theme.php index 00281f06a8..35baee0012 100644 --- a/wp-includes/class-wp-theme.php +++ b/wp-includes/class-wp-theme.php @@ -1139,11 +1139,21 @@ final class WP_Theme implements ArrayAccess { $results = scandir( $path ); $files = array(); + /** + * Filters the array of excluded directories and files while scanning theme folder. + * + * @since 4.7.4 + * + * @param array $exclusions Array of excluded directories and files. + */ + $exclusions = (array) apply_filters( 'theme_scandir_exclusions', array( 'CVS', 'node_modules' ) ); + foreach ( $results as $result ) { - if ( '.' == $result[0] ) + if ( '.' == $result[0] || in_array( $result, $exclusions, true ) ) { continue; + } if ( is_dir( $path . '/' . $result ) ) { - if ( ! $depth || 'CVS' == $result ) + if ( ! $depth ) continue; $found = self::scandir( $path . '/' . $result, $extensions, $depth - 1 , $relative_path . $result ); $files = array_merge_recursive( $files, $found ); diff --git a/wp-includes/version.php b/wp-includes/version.php index e9cb8d95d1..c9c1e1c024 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7.4-alpha-40325'; +$wp_version = '4.7.4-alpha-40326'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.