WordPress output search keyword tag: the_ search_ query

WordPress template tags the_ search_ Query is used to output search keywords, which are usually used in search forms and search results pages.


The function does not have any parameters and can be called directly.

Examples of function usage

<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
		<input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
		<input type="submit" id="searchsubmit" value="Search" />

Extended reading

the_ search_ The query() function is located in: WP includes / general- template.php

Related Tags:

  • get_ search_ query()
Related Article
WordPress comment content tag: comment_ text

WordPress template tags comment_ Text is used to output comments. It is usually used in custom comment templates. comment_text( integer Read more

WordPress comment time tag: comment_time

WordPress template tags comment_ Time is used to output the publishing time of the current comment, which is the same Read more

WordPress RSS format comment author name tag: comment_author_rss

WordPress template tags comment_ author_ RSS is used to output the comment author name in RSS format, which has no Read more

WordPress comment form title tags: comment_form_title

WordPress template tags comment_ form_ Title is used to output the title of a comment form, which is usually used Read more

Leave a Reply

Your email address will not be published. Required fields are marked *

To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-spam image