1. Home
  2. Wordpress
  3. Escape html

esc_html is a method allowing you to escape html from a string passed as an attribute.

#wordpress#php
$copy = "Text <span> with some html </span>."
/* Returns 'Text with some html'.

$escapeHtml = esc_html($copy);
/* Returns: 'Text <span> with some html </span>'.
copy
Full Wordpress cheatsheet
NordVPN NordVPN