1

I need to disable this filter:

$message = apply_filters( 'woocommerce_mail_content', $this->style_inline( $message ) );

The style_inline() function exist in a class called WC_Email. So I tried:

remove_filter("woocommerce_mail_content", WC()->WC_Email->style_inline());

But it was a wild guess and it didn't work.

Link to the full apply_filters code: here

Link to the style_online() function: here

  • are you trying to remove the inline styles from the message? – birgire Oct 23 '16 at 19:08
0

Note that to remove a filter callback from the woocommerce_email_content filter, you first need to have it registered via:

add_filter( 'woocommerce_email_content', ...some-custom-callback... );

but it looks like you're trying to remove the inline styles from the message.

I guess you need the text/html content type, so try instead to override the styles with (untested):

add_filter( 'woocommerce_email_styles', '__return_null' );
  • What if i need to have a condition check to remove woocommerce_email_styles hook? Also i think it is not possible to have an add_filter inside function. – melvin Mar 19 '18 at 9:25
  • 1
    I guess it depends on how plugins are hooking into that filter. One could try to create a callback for the woocommerce_email_styles filter with high priority (e.g. 9999) and include the check there if null should be returned? – birgire Mar 19 '18 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.