Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
23 votes
2 answers
33k views

What’s the difference between esc_html, esc_attr, esc_html_e, and so on?

I got feedback from security guy and he pointed out that I should use proper escaping of user input in my code. So I've done some research and found escaping functions. What’s the difference between ...
baldrick's user avatar
  • 241
8 votes
2 answers
3k views

Which WP functions do you need to use esc_html() or esc_url() on?

I've come across situations where people have used either esc_html() or esc_url() with certain WP functions such as home_url('/'). An example being in the opening anchor tag of <a> link back to ...
pjk_ok's user avatar
  • 908
1 vote
0 answers
2k views

mysql_real_escape_string() vs. esc_sql() in WordPress

Does mysql_real_escape_string() and esc_sql() in WordPress both do the same thing? I tried the following: $fetch_row='<p>And again for single posts</p>' echo mysql_real_escape_string( $...
Thamaraiselvam's user avatar
0 votes
0 answers
405 views

Escaping a Single Quote in str_replace for Nav Function

I'm trying to modify a nav walker so that it displays the menu item's description. I'm basing my solution off of https://themefoundation.com/menu-item-descriptions/, and have provided the function ...
Mike B.'s user avatar
  • 169
0 votes
0 answers
174 views

site_url() returns with additional backslashes

I am using site_url() function and it returns the address as http:\/\/vip.local\/cc where I can see that WP automatically adds unnecessary backslashes. Is this for some escaping purpose? I tried using ...
user3312508's user avatar