woocommerce - 如何从钩子 woocommerce_subscription_totals_table 中删除 get_subscription_totals_template 函数
问题描述
我想用我的插件版本的订阅总计表替换 WooCommerce 订阅提供的订阅总计。
在 WooCommerce Subsciptions 插件class-wcs-template-loader.php
中有一行加载订阅总模板
add_action( 'woocommerce_subscription_totals_table', array( __CLASS__, 'get_subscription_totals_template' ) );
我正在尝试从钩子中删除该函数并将其替换为我自己的模板版本。但它不工作!
我在我的插件文件中写了以下内容
remove_action( 'woocommerce_subscription_totals_table', array( __CLASS__, 'get_subscription_totals_template' ) );
但它不工作。
解决方案
把这个改为:
remove_action( 'woocommerce_subscription_totals_table', array( 'WCS_Template_Loader', 'get_subscription_totals_template' ) );
推荐阅读
- google-sheets - TEXT() 等效于 Google 表格中的字符串?
- c - 如何使用 got 从汇编程序中访问 glibc 数据类型?
- flutter - 如何更改颤振应用程序键盘中输入键的颜色?
- c - 这不是错误,但是这个 getchar() 函数给出了前一个数组的值,为什么?
- gatling - 我们可以有选择地禁用重定向(针对特定请求)吗?
- javascript - 反应中 ForwardRefExoticComponent 和 ForwardRefRenderFunction 有什么区别?
- pandas - pandas.Dataframe.loc[index] 这是如何工作的?
- python-3.x - 从“选择”中选择没有 ID、名称或 XPATH 的下拉项目?
- python - 如何在python pandas中将值范围更改为实际值
- java - 反射 - 获取列表的大小