On my site's search results page I am outputting the search term as follows:
<?php echo esc_html($_GET['s']); ?>
For the search term "SEARCH-TERM" (including the quotes) I would expect this to appear in the source as:
But what the source actually contains is:
which appears on the page as \"SEARCH-TERM\".
I am also outputting the search term as follows:
<input type="search" value="<?php echo esc_attr($_GET['s']); ?>">
This is appearing in the source as:
<input type="search" value="\"SEARCH-TERM\"">
and is actually appearing in the input box as \"SEARCH-TERM\" when viewed by the user.
The search term appears in the URL as %22SEARCH-TERM%22 which I believe is the correct URL representation of the search phrase.
I am struggling to understand why the characters are not being escaped as expected when using
Any insight would be greatly appreciated.
I am running WordPress version 4.4.2.