I understand when using certain WP functions like site_url(); you should escape these with the esc_html(); function in the following manner:
<?php esc_html(site_url()) ?>
My question is, if I have inputted the site url manually in a template file such as front-page.php like this:
<a href="//mysite.com">My Site</a>
Do I still need to use the esc_html() function? It doesn't mention anything about this use-case in the docs. And if so how do I go about this?
Many thanks
esc_html()
wouldn't be the correct function for links. You'd useesc_url()
, but you don't need to for hard-coded links.