0

From the articles on Codex, esc_attr_e is proper way to escaping value for translation. But from other articles, I read about sanitizing issue and security issue for some escaping code. For my code, I am using this:

 <h4><?php esc_attr_e( 'PREVIOUS ARTICLE', 'myweb' ); ?></h4>

Is my code proper for translation? If no, what the code should I use for?

Really appreciate for any help

Thank you

1 Answer 1

1

You should use esc_html_e() instead of esc_attr_e() if you intend to escape your translation.

What is proper depends on your intend

Escaping attributes are well, for escaping attributes inside html tags like inline styles, datas, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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