Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

User:T31os/get search query


Retrieve the contents of the WordPress search query variable.
It could for example be used to show a brief message whilst displaying the user's search terms, you could use the following.


You have searched for: <?php echo esc_attr( get_search_query() ); ?>


Source File

get_search_query() is located in wp-includes/general-template.php.

This article is a ROUGH DRAFT. The author is still working on this document, so please do not edit this without the author's permission. The content within this article may not yet be verified or valid. This information is subject to change.