Support » Fixing WordPress » How To:Show Search Query (Without XSS Vulnerability?)

  • Hello all! I’d like to repeat the search query on my search page saying something like.

    Your search for “QUERY” returned:

    Or something like that?

    I’ve noticed that the search query shows up in the search box if no results are returned, I’d just like it to show up as text on the page. Any ideas?!? THANKS!

Viewing 4 replies - 1 through 4 (of 4 total)
  • not sure but try this plugin
    It’s designed to show the Number of Search Results (how many hits on that search term), but I think it also shows what the search term is.

    All you should need is:

    <?php echo $s; ?>

    in your search template. $s is a global WordPress variable that’s available on search query pages. This is what the search form would effectively be using.

    Mark (podz)


    Support Maven

    The title of this thread implies a vulnerability that is not known to WP.
    So there isn’t one 🙂

    Sorry guys/girls, I assumed this function would be open to XSS, glad it’s not! And thanks for the code Kafkaesqui, is there a page you could recommend for a list of more advanced features such as the template_tags page but that talks about <?php echo $s; ?> and such?? Thanks again!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How To:Show Search Query (Without XSS Vulnerability?)’ is closed to new replies.