How To:Show Search Query (Without XSS Vulnerability?) (5 posts)

  1. winpoka
    Posted 9 years ago #

    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!

  2. Dgold
    Posted 9 years ago #

    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.

  3. Kafkaesqui

    Posted 9 years ago #

    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.

  4. Mark (podz)
    Support Maven
    Posted 9 years ago #

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

  5. winpoka
    Posted 9 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic