Maybe I’m missing something, but I’m trying to use escape() on a string and I’m getting an error, “Call to a member function escape() on string”.
<h2>Showing results for “<?= $query->escape() ?>”</h2>
Maybe I’m missing something, but I’m trying to use escape() on a string and I’m getting an error, “Call to a member function escape() on string”.
<h2>Showing results for “<?= $query->escape() ?>”</h2>
You can use esc()
helper function:
<?= esc($query) ?>
The way you are trying to use it above only works for fields (because escape()
is a field method).