the_search_query

函式
the_search_query ( No parameters )

search_query是一個WordPress函式,用於檢索使用者輸入的搜尋查詢字串。

顯示搜尋查詢變數的內容。

搜尋查詢字串通過esc_attr()傳遞,以確保它可以安全地放置在一個HTML屬性中。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function the_search_query() {
/**
* Filters the contents of the search query variable for display.
*
* @since 2.3.0
*
* @param mixed $search Contents of the search query variable.
*/
echo esc_attr( apply_filters( 'the_search_query', get_search_query( false ) ) );
}
function the_search_query() { /** * Filters the contents of the search query variable for display. * * @since 2.3.0 * * @param mixed $search Contents of the search query variable. */ echo esc_attr( apply_filters( 'the_search_query', get_search_query( false ) ) ); }
function the_search_query() {
	/**
	 * Filters the contents of the search query variable for display.
	 *
	 * @since 2.3.0
	 *
	 * @param mixed $search Contents of the search query variable.
	 */
	echo esc_attr( apply_filters( 'the_search_query', get_search_query( false ) ) );
}

常見問題

FAQs
檢視更多 >