woocommerce_has_block_template
Filters the value of the result of the block template check.
Использование
add_filter( 'woocommerce_has_block_template', 'wp_kama_woocommerce_has_block_template_filter', 10, 2 );
/**
* Function for `woocommerce_has_block_template` filter-hook.
*
* @param boolean $has_template value to be filtered.
* @param string $template_name The name of the template.
*
* @return boolean
*/
function wp_kama_woocommerce_has_block_template_filter( $has_template, $template_name ){
// filter...
return $has_template;
}
- $has_template(true|false)
- value to be filtered.
- $template_name(строка)
- The name of the template.
Список изменений
| С версии 10.2.0 | Введена. |
Где вызывается хук
woocommerce_has_block_template
woocommerce/includes/class-wc-template-loader.php 147
return (bool) apply_filters( 'woocommerce_has_block_template', $has_template, $template_name );
Где используется хук в WooCommerce
woocommerce/src/Blocks/Templates/ProductBrandTemplate.php 68
add_filter( 'woocommerce_has_block_template', '__return_true', 10, 0 );
woocommerce/src/Blocks/Templates/ProductCategoryTemplate.php 68
add_filter( 'woocommerce_has_block_template', '__return_true', 10, 0 );
woocommerce/src/Blocks/Templates/ProductTagTemplate.php 68
add_filter( 'woocommerce_has_block_template', '__return_true', 10, 0 );