get_search_link()
Gets the search page URL considering the current/specified search query.
The search query is processed by the urlencode() function.
Uses: get_search_query()
1 time — 0.000102 sec (fast) | 50000 times — 2.75 sec (fast)
Hooks from the function
Returns
String. The search page URL.
Usage
get_search_link( $query );
- $query(string)
- The search query. If not specified, the current query will be used: get_search_query( false )
Default: ''
Examples
#1 We get a link to the search page with a search query
echo get_search_link( 'something' ); // http://example.com/search/something echo get_search_link( 'foo " bar' ); // http://example.com/search/foo+%22+bar
Notes
- Global. WP_Rewrite. $wp_rewrite WordPress rewrite component.
Changelog
| Since 3.0.0 | Introduced. |