Is it necessary to use esc_url with template tags such as get_permalink?

sanitizing have nothing to do with escaping, and escaping is not a cure to everything.

The role of escaping is to convert a string to a proper HTML. What is a proper HTML representation of a string might depend upon the context and that is the reason you have several escaping functions esc_html,esc_url and esc_attr.

Unlike escaping which have to preserve the meaning of the string sanitizing might remove/change parts of it. For example a user in an author role can add iframes ia the “test” tab of the editor but they will be removed from the content when it will be saved as part of sanitizing it.

Sanitizing should be done when escaping will not be done. For example think of a widget in which you input the embed code of some youtube video. This code is supposed to get as it is into the HTML generated by the site and escaping it will ruin it, therefor you need to sanitize the content before displaying it to make sure that it indeed contains a valid youtube embed code and nothing more.

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş