theme_block_pattern_files
Filters list of block pattern files for a theme.
Использование
add_filter( 'theme_block_pattern_files', 'wp_kama_theme_block_pattern_files_filter', 10, 2 );
/**
* Function for `theme_block_pattern_files` filter-hook.
*
* @param array $files Array of theme files found within `patterns` directory.
* @param string $dirpath Path of theme `patterns` directory being scanned.
*
* @return array
*/
function wp_kama_theme_block_pattern_files_filter( $files, $dirpath ){
// filter...
return $files;
}
- $files(массив)
- Array of theme files found within
patternsdirectory. - $dirpath(строка)
- Path of theme
patternsdirectory being scanned.
Список изменений
| С версии 6.8.0 | Введена. |
Где вызывается хук
theme_block_pattern_files
wp-includes/class-wp-theme.php 1871
$files = apply_filters( 'theme_block_pattern_files', $files, $dirpath );