woocommerce_blocks_hook_compatibility_additional_data
When extensions implement their equivalent blocks of the template hook functions, they can use this filter to register their old hooked data here, so in the blockified template, the old hooked functions can be removed in favor of the new blocks while keeping the old hooked functions working in classic templates.
Accepts an array of hooked data. The array should be in the following format: [ [
hook => <hook-name>, function => <function-name>, priority => <priority>,
], ... ] Where:
- hook-name is the name of the hook that have the functions hooked to.
- function-name is the hooked function name.
- priority is the priority of the hooked function.
Использование
add_filter( 'woocommerce_blocks_hook_compatibility_additional_data', 'wp_kama_woocommerce_blocks_hook_compatibility_additional_data_filter', 10, 2 ); /** * Function for `woocommerce_blocks_hook_compatibility_additional_data` filter-hook. * * @param array $data Additional hooked data. Default to empty * @param string $class_name Class name within which the hook is called. Either ArchiveProductTemplatesCompatibility or SingleProductTemplateCompatibility. * * @return array */ function wp_kama_woocommerce_blocks_hook_compatibility_additional_data_filter( $data, $class_name ){ // filter... return $data; }
- $data(массив)
- Additional hooked data. Default to empty
- $class_name(строка)
- Class name within which the hook is called. Either ArchiveProductTemplatesCompatibility or SingleProductTemplateCompatibility.
Список изменений
С версии 9.5.0 | Введена. |
Где вызывается хук
woocommerce_blocks_hook_compatibility_additional_data
woocommerce/src/Blocks/Templates/AbstractTemplateCompatibility.php 167
$additional_hook_data = apply_filters( 'woocommerce_blocks_hook_compatibility_additional_data', array(), $class_name );