在我的产品模板上,我执行此操作:
<?PHP
/**
* woocommerce_single_product_summary hook.
*
* @hooked woocommerce_template_single_title - 5
* @hooked woocommerce_template_single_rating - 10
* @hooked woocommerce_template_single_price - 10
* @hooked woocommerce_template_single_excerpt - 20
* @hooked woocommerce_template_single_add_to_cart - 30
* @hooked woocommerce_template_single_Meta - 40
* @hooked woocommerce_template_single_sharing - 50
*/
do_action('woocommerce_single_product_summary');
?>
我想要的是删除woocommerce_template_single_title钩子,所以在我的functions.PHP文件中我编写了这段代码:
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_title', 1);
但它不起作用,我不知道如何.
谢谢你的帮助
!编辑!!
没关系,我写下来解决了这个问题:
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_title', 5);
优先级必须匹配
解决方法:
The author has added the one-liner to his question; as suggested by @Bugs, here it is as an answer.
// Remove title hook Woocommerce
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_title', 5);