微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – 删除标题钩Woocommerce

在我的产品模板上,我执行此操作:

<?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);

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐