get_query_var( string $var, mixed $default = '' )
Retrieve variable in the WP_Query class.
Parameters
- $var
-
(Required) The variable key to retrieve.
- $default
-
(Optional) Value to return if the query variable is not set.
Default value: ''
Return
(mixed) Contents of the query variable.
Source
File: wp-includes/query.php
function get_query_var( $var, $default = '' ) {
global $wp_query;
return $wp_query->get( $var, $default );
}
Related
Uses
Uses | Description |
---|---|
wp-includes/class-wp-query.php: WP_Query::get() |
Retrieve query variable. |
Used By
Used By | Description |
---|---|
wp-includes/general-template.php: get_search_query() |
Retrieves the contents of the search ClassicPress query variable. |
wp-includes/general-template.php: paginate_links() |
Retrieve paginated link for archive post pages. |
wp-includes/general-template.php: feed_links_extra() |
Display the links to the extra feeds such as category feeds. |
wp-includes/general-template.php: get_the_post_type_description() |
Retrieves the description for a post type archive. |
wp-includes/general-template.php: wp_title() |
Display or retrieve page title for all areas of blog. |
wp-includes/general-template.php: post_type_archive_title() |
Display or retrieve title for a post type archive. |
wp-includes/general-template.php: single_month_title() |
Display or retrieve page title for post archive based on date. |
wp-includes/template.php: get_page_template() |
Retrieve path of page template in current or parent template. |
wp-includes/template.php: get_archive_template() |
Retrieve path of archive template in current or parent template. |
wp-includes/template.php: get_post_type_archive_template() |
Retrieve path of post type archive template in current or parent template. |
wp-includes/query.php: wp_old_slug_redirect() |
Redirect old slugs to the correct permalink. |
wp-includes/query.php: _find_post_by_old_slug() |
Find the post ID for redirecting an old slug. |
wp-includes/query.php: _find_post_by_old_date() |
Find the post ID for redirecting an old date. |
wp-includes/comment.php: get_page_of_comment() |
Calculate what page number a comment will appear on for comment paging. |
wp-includes/comment.php: get_comment_pages_count() |
Calculate the total number of comment pages. |
wp-includes/link-template.php: wp_get_canonical_url() |
Returns the canonical URL for a post. |
wp-includes/link-template.php: get_next_comments_link() |
Retrieves the link to the next comments page. |
wp-includes/link-template.php: get_previous_comments_link() |
Retrieves the link to the previous comments page. |
wp-includes/link-template.php: paginate_comments_links() |
Displays or retrieves pagination links for the comments on the current post. |
wp-includes/link-template.php: get_posts_nav_link() |
Retrieves the post pages link navigation for previous and next pages. |
wp-includes/user.php: wp_dropdown_users() |
Create dropdown HTML content of users. |
wp-includes/category-template.php: wp_dropdown_categories() |
Display or retrieve the HTML dropdown list of categories. |
wp-includes/post-template.php: get_body_class() |
Retrieve the classes for the body element as an array. |
wp-includes/canonical.php: redirect_canonical() |
Redirects incoming links to the proper URL based on the site url. |
wp-includes/canonical.php: redirect_guess_404_permalink() |
Attempts to guess the correct URL based on query vars |
wp-includes/class-wp.php: WP::handle_404() |
Set the Headers for 404, if nothing is found for requested URL. |
wp-includes/comment-template.php: wp_list_comments() |
List comments. |
wp-includes/comment-template.php: comments_template() |
Load the comment template specified in $file. |
wp-includes/comment-template.php: get_comment_link() |
Retrieve the link to a given comment. |
wp-includes/functions.php: do_feed() |
Load the feed template from the use of an action hook. |
Changelog
Version | Description |
---|---|
WP-3.9.0 | The $default argument was introduced. |
WP-1.5.0 | Introduced. |