esc($string, $context = 'html', $strict = false)

Escapes strings based on the output context

  • $string (string)
  • $context (string)
    Location of output of the string
  • $context (string)
    Whether to escape an extended set of characters (HTML attributes only)
  • return (string)


echo esc($page->title(), 'html');

echo esc($page->link(), 'url');

Please check the Escape class documentation and its source code for more details and the available methods.

Is something missing or incorrect? Edit this page on Github…