• Resolved petebm

    (@petebm)


    Hi

    I’m using my own email templates in a child theme, and having recently updated Woocommerce and copied the new templates over, I’ve lost the bold & line break formatting that I had, presumably because

    p><?php printf( __( “Thank you – your recent order . . .
    has been changed to
    <p><?php printf( esc_html__( ‘Thank you – your recent order . . .

    I’ve read up on esc_html, & from what I’ve understood, I think I can just revert to the previous non esc_html for those lines – but since I’m not an expert in this, I’d like to ask if I can. Or do I have to lose my formatting, as examples I’ve found of getting formatting in esc_html are beyond my skills!

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support AW a11n

    (@slash1andy)

    Automattic Happiness Engineer

    Hey there!

    You are correct, that you can change it back to use it without escaping, but I’d like to provide a bit of the background to why that’s used.

    escaping the html is a way to help promote safety in code, as it helps eliminate the damage that can be done by malicious code.

    you can read more here: https://codex.www.ads-software.com/Function_Reference/esc_html

    https://codex.www.ads-software.com/Data_Validation

    Hopefully that helps! Have a great one!

    Thread Starter petebm

    (@petebm)

    Hi

    Thanks very much for the reply, which pretty much mirrored what I understood from reading about escaping. However, I hadn’t seen the reference to ‘wp_kses’ or ‘wp_kses_post’ before; am I right in thinking that I could use that to insert html tags – eg line breaks & bold text – in my custom email templates?

    Pete

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Using html tag in email template’ is closed to new replies.