Is there a way to remove woocommerce_email_header action hook from emails without changing the plugin file?

huangapple go评论131阅读模式
英文:

Is there a way to remove woocommerce_email_header action hook from emails without changing the plugin file?

问题

Here is the translated text:

"有没有人知道如何在不编辑插件文件的情况下移除这个动作 email_header,该动作在插件文件中被调用(插件 -> WooCommerce -> 包括 -> class-wc-emails.php)。

我可以使用以下代码来移除该类:

remove_action('woocommerce_email_header', array($this, 'email_header'));

但只能在插件文件中使用。另外,我也尝试过:

remove_action('woocommerce_email_header', array('WC_Emails', 'email_header'));

图片链接"

请注意,代码部分不会进行翻译。如果还有其他需要翻译的内容,请继续提供。

英文:

Is there a way to remove woocommerce_email_header action hook from emails without changing the plugin file?

Does anyone know how to remove this action email_header without editing this plugin file which the action is called in (plugins->woocommerce->includes->class-wc-emails.php).

I can remove the class with:

remove_action( 'woocommerce_email_header', array( $this, 'email_header' ) );

But only in the plugin file. Also I've tried:

remove_action( 'woocommerce_email_header', array( 'WC_Emails', 'email_header' ) );

答案1

得分: 1

以下是移除页眉的代码。如果有人需要,我将它保留在这里。

add_action('woocommerce_email', 'remove_wc_header');

function remove_wc_header($email_class) {

	remove_action( 'woocommerce_email_header', array( $email_class, 'email_header' ), 10, 4 );
}
英文:
add_action('woocommerce_email', 'remove_wc_header');

function remove_wc_header($email_class) {
	
	remove_action( 'woocommerce_email_header', array( $email_class, 'email_header' ), 10, 4 );
}

Here is the code to remove the header. I'll leave it here if anyone needs it

huangapple
  • 本文由 发表于 2023年5月25日 17:04:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/76330564.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定