WordPress.org

Ready to get started?Download WordPress

Forums

question about the_search_query() (2 posts)

  1. otravers
    Member
    Posted 7 years ago #

    Hi, I'm trying to pass along search queries to my own php variable, but the_search_query() seems to only directly output content to the browser. In other words, this doesn't seem to work:
    $SearchQuery = the_search_query();

    Questions:

    - Is there a function for search similar to what the_title(false) or get_the_title allow?
    http://wiki.wordpress.org/?pagename=get_the_title

    - does the_search_query() work only inside the Loop?

    Any help appreciated, thanks. I have searched the codex, this forum, and Google, and found very little information about the WordPress search engine.

    While I'm at it, suggestions to improve the documentation:

    - put something at http://codex.wordpress.org/Search

    - add a search section in http://codex.wordpress.org/Template_Tags

  2. otravers
    Member
    Posted 7 years ago #

    Well, since we're using a GET search form, I went ahead and used the PHP variable from the URL parameter instead ($s). It still wouldn't hurt to have more documentation about WordPress search.

Topic Closed

This topic has been closed to new replies.

About this Topic