theme_block_pattern_files
Filter HookDescription
Filters list of block pattern files for a theme.Hook Information
File Location |
wp-includes/class-wp-theme.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1871 |
Hook Parameters
Type | Name | Description |
---|---|---|
array
|
$files
|
Array of theme files found within `patterns` directory. |
string
|
$dirpath
|
Path of theme `patterns` directory being scanned. |
Usage Examples
Basic Usage
<?php
// Hook into theme_block_pattern_files
add_filter('theme_block_pattern_files', 'my_custom_filter', 10, 2);
function my_custom_filter($files, $dirpath) {
// Your custom filtering logic here
return $files;
}
Source Code Context
wp-includes/class-wp-theme.php:1871
- How this hook is used in WordPress core
<?php
1866 * @since 6.8.0
1867 *
1868 * @param array $files Array of theme files found within `patterns` directory.
1869 * @param string $dirpath Path of theme `patterns` directory being scanned.
1870 */
1871 $files = apply_filters( 'theme_block_pattern_files', $files, $dirpath );
1872
1873 $dirpath = trailingslashit( $dirpath );
1874
1875 if ( ! $files ) {
1876 if ( $can_use_cached ) {
PHP Documentation
<?php
/**
* 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.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/class-wp-theme.php
Related Hooks
Related hooks will be displayed here in future updates.