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

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...