Filter hook 'theme_scandir_exclusions'

in WP Core File wp-includes/class-wp-theme.php at line 1480

View Source

theme_scandir_exclusions

Filter Hook
Description
Filters the array of excluded directories and files while scanning theme folder.

Hook Information

File Location wp-includes/class-wp-theme.php View on GitHub
Hook Type Filter
Line Number 1480

Hook Parameters

Type Name Description
string[] $exclusions Array of excluded directories and files.

Usage Examples

Basic Usage
<?php
// Hook into theme_scandir_exclusions
add_filter('theme_scandir_exclusions', 'my_custom_filter', 10, 1);

function my_custom_filter($exclusions) {
    // Your custom filtering logic here
    return $exclusions;
}

Source Code Context

wp-includes/class-wp-theme.php:1480 - How this hook is used in WordPress core
<?php
1475  		 *
1476  		 * @since 4.7.4
1477  		 *
1478  		 * @param string[] $exclusions Array of excluded directories and files.
1479  		 */
1480  		$exclusions = (array) apply_filters( 'theme_scandir_exclusions', array( 'CVS', 'node_modules', 'vendor', 'bower_components' ) );
1481  
1482  		foreach ( $results as $result ) {
1483  			if ( '.' === $result[0] || in_array( $result, $exclusions, true ) ) {
1484  				continue;
1485  			}

PHP Documentation

<?php
/**
		 * Filters the array of excluded directories and files while scanning theme folder.
		 *
		 * @since 4.7.4
		 *
		 * @param string[] $exclusions Array of excluded directories and files.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/class-wp-theme.php
Related Hooks

Related hooks will be displayed here in future updates.