I added the following code to the theme's index.php file on one of my WordPress sites, so that a heading would appear on the search results page that includes the actual search term. In other words, if I search for the word blue, this heading would then read, Search results for: blue.
<?php
if ( is_search() ); ?>
<h3>Search results for: <?php print_r($_GET['s']); ?></h3>
The output isn't great however when a phase in quotes get placed into the search bar. In other words, if I search for the phrase "blue is a color", this heading then reads: Search resulst for: \"blue is a color\"
I'd like to know how to stop those backslashes from appearing. I've done some research but nothing I've found has worked. I'm a php beginner at most.
Search results for:
` Is this a good solution? It works. – Jutta Duncan Feb 11 '16 at 16:58Search results for:
` – Jutta Duncan Feb 11 '16 at 21:06