I have been struggling to remove the wpautop
filter from the retrieve_password_message
function. I created a new email message and want to keep my <br>
s instead of having automatic paragraphs added - since most email clients can't handle well <p>
paddings or margins.
Any help?
I have been struggling to remove the wpautop
filter from the retrieve_password_message
function. I created a new email message and want to keep my <br>
s instead of having automatic paragraphs added - since most email clients can't handle well <p>
paddings or margins.
Any help?
Share Improve this question asked Jul 23, 2020 at 8:10 scooterlordscooterlord 1137 bronze badges 6 | Show 1 more comment1 Answer
Reset to default 0Thanks to the constructive conversation with Jacob in the comments, I did some additional tests and realized that the <p>
tags were in fact added by the plugin - testing in ive environment revealed that the email was plain text.
The solution to the problem was to add the following snippet in my functions.php
:
function email_set_content_type(){
return "text/html";
}
add_filter( 'wp_mail_content_type','email_set_content_type' );
wpautop
is not applied toretrieve_password_message
. In fact, the password reset email does not even appear to be an HTML email, so HTML tags wouldn't even work. – Jacob Peattie Commented Jul 23, 2020 at 8:48wpautop()
? I know, but where is it applied to the password reset email? – Jacob Peattie Commented Jul 23, 2020 at 9:29