WP_Query
class WP_Query
// Constructor: function Object() { [native code] } The WordPress Query class.
Methods 68 methods
| Method / Return | Description |
|---|---|
| init_query_flags() void | Resets query flags to false. |
| init() void | Initiates object properties and sets default values. |
| parse_query_vars() void | Reparses the query vars. |
| fill_query_vars() array | Fills in the query variables, which do not exist within the parameter.
Parameters: $query_vars: mixed |
| parse_query() void | Parses a query string and sets query type booleans.
Parameters: $query: mixed |
| parse_tax_query() void | Parses various taxonomy related query vars.
Parameters: $q: mixed |
| parse_search() string | Generates SQL for the WHERE clause based on passed search terms.
Parameters: $q: mixed |
| parse_search_terms() string[] | Checks if the terms are suitable for searching.
Parameters: $terms: mixed |
| get_search_stopwords() string[] | Retrieves stopwords used when parsing search terms. |
| parse_search_order() string | Generates SQL for the ORDER BY condition based on passed search terms.
Parameters: $q: mixed |
| parse_orderby() (string | Converts the given orderby alias (if allowed) to a properly-prefixed value.
Parameters: $orderby: mixed |
| parse_order() string | Parse an 'order' query variable and cast it to ASC or DESC as necessary.
Parameters: $order: mixed |
| set_404() void | Sets the 404 property and saves whether query is feed. |
| get() mixed | Retrieves the value of a query variable.
Parameters: $query_var: mixed, $default_value: mixed |
| set() void | Sets the value of a query variable.
Parameters: $query_var: mixed, $value: mixed |
| get_posts() (WP_Post[] | Retrieves an array of posts based on query variables. |
| set_found_posts() void | Sets up the amount of found posts and the number of pages (if limit clause was used)
Parameters: $q: mixed, $limits: mixed |
| next_post() WP_Post | Sets up the next post and iterate current post index. |
| the_post() void | Sets up the current post. |
| have_posts() bool | Determines whether there are more posts available in the loop. |
| rewind_posts() void | Rewinds the posts and resets post index. |
| next_comment() WP_Comment | Iterates current comment index and returns WP_Comment object. |
| the_comment() void | Sets up the current comment. |
| have_comments() bool | Determines whether there are more comments available. |
| rewind_comments() void | Rewinds the comments, resets the comment index and comment to first. |
| query() (WP_Post[] | Sets up the WordPress query by parsing query string.
Parameters: $query: mixed |
| get_queried_object() (WP_Term | Retrieves the currently queried object. |
| get_queried_object_id() int | Retrieves the ID of the currently queried object. |
| __construct() void | Constructor.
Parameters: $query: mixed |
| __get() mixed | Makes private properties readable for backward compatibility.
Parameters: $name: mixed |
| __isset() bool | Makes private properties checkable for backward compatibility.
Parameters: $name: mixed |
| __call() (mixed | Makes private/protected methods readable for backward compatibility.
Parameters: $name: mixed, $arguments: mixed |
| is_archive() bool | Determines whether the query is for an existing archive page. |
| is_post_type_archive() bool | Determines whether the query is for an existing post type archive page.
Parameters: $post_types: mixed |
| is_attachment() bool | Determines whether the query is for an existing attachment page.
Parameters: $attachment: mixed |
| is_author() bool | Determines whether the query is for an existing author archive page.
Parameters: $author: mixed |
| is_category() bool | Determines whether the query is for an existing category archive page.
Parameters: $category: mixed |
| is_tag() bool | Determines whether the query is for an existing tag archive page.
Parameters: $tag: mixed |
| is_tax() bool | Determines whether the query is for an existing custom taxonomy archive page.
Parameters: $taxonomy: mixed, $term: mixed |
| is_comments_popup() false | Determines whether the current URL is within the comments popup window. |
| is_date() bool | Determines whether the query is for an existing date archive. |
| is_day() bool | Determines whether the query is for an existing day archive. |
| is_feed() bool | Determines whether the query is for a feed.
Parameters: $feeds: mixed |
| is_comment_feed() bool | Determines whether the query is for a comments feed. |
| is_front_page() bool | Determines whether the query is for the front page of the site. |
| is_home() bool | Determines whether the query is for the blog homepage. |
| is_privacy_policy() bool | Determines whether the query is for the Privacy Policy page. |
| is_month() bool | Determines whether the query is for an existing month archive. |
| is_page() bool | Determines whether the query is for an existing single page.
Parameters: $page: mixed |
| is_paged() bool | Determines whether the query is for a paged result and not for the first page. |
| is_preview() bool | Determines whether the query is for a post or page preview. |
| is_robots() bool | Determines whether the query is for the robots.txt file. |
| is_favicon() bool | Determines whether the query is for the favicon.ico file. |
| is_search() bool | Determines whether the query is for a search. |
| is_single() bool | Determines whether the query is for an existing single post.
Parameters: $post: mixed |
| is_singular() bool | Determines whether the query is for an existing single post of any post type
Parameters: $post_types: mixed |
| is_time() bool | Determines whether the query is for a specific time. |
| is_trackback() bool | Determines whether the query is for a trackback endpoint call. |
| is_year() bool | Determines whether the query is for an existing year archive. |
| is_404() bool | Determines whether the query is a 404 (returns no results). |
| is_embed() bool | Determines whether the query is for an embedded post. |
| is_main_query() bool | Determines whether the query is the main query. |
| setup_postdata() true | Sets up global post data.
Parameters: $post: mixed |
| generate_postdata() (array | Generates post data.
Parameters: $post: mixed |
| generate_cache_key() string | Generates cache key.
Parameters: $args: array, $sql: mixed |
| reset_postdata() void | After looping through a nested query, this function |
| lazyload_term_meta() mixed | Lazyloads term meta for posts in the loop.
Parameters: $check: mixed, $term_id: mixed |
| lazyload_comment_meta() mixed | Lazyloads comment meta for comments in the loop.
Parameters: $check: mixed, $comment_id: mixed |
Properties
| Property / Type | Description |
|---|---|
| $query mixed public | No description available. |
| $query_vars mixed public | No description available. |
| $tax_query mixed public | No description available. |
| $meta_query mixed public | No description available. |
| $date_query mixed public | No description available. |
| $queried_object mixed public | No description available. |
| $queried_object_id mixed public | No description available. |
| $request mixed public | No description available. |
| $posts mixed public | No description available. |
| $post_count mixed public | No description available. |
| $current_post mixed public | No description available. |
| $before_loop mixed public | No description available. |
| $in_the_loop mixed public | No description available. |
| $post mixed public | No description available. |
| $comments mixed public | No description available. |
| $comment_count mixed public | No description available. |
| $current_comment mixed public | No description available. |
| $comment mixed public | No description available. |
| $found_posts mixed public | No description available. |
| $max_num_pages mixed public | No description available. |
| $max_num_comment_pages mixed public | No description available. |
| $is_single mixed public | No description available. |
| $is_preview mixed public | No description available. |
| $is_page mixed public | No description available. |
| $is_archive mixed public | No description available. |
| $is_date mixed public | No description available. |
| $is_year mixed public | No description available. |
| $is_month mixed public | No description available. |
| $is_day mixed public | No description available. |
| $is_time mixed public | No description available. |
| $is_author mixed public | No description available. |
| $is_category mixed public | No description available. |
| $is_tag mixed public | No description available. |
| $is_tax mixed public | No description available. |
| $is_search mixed public | No description available. |
| $is_feed mixed public | No description available. |
| $is_comment_feed mixed public | No description available. |
| $is_trackback mixed public | No description available. |
| $is_home mixed public | No description available. |
| $is_privacy_policy mixed public | No description available. |
| $is_404 mixed public | No description available. |
| $is_embed mixed public | No description available. |
| $is_paged mixed public | No description available. |
| $is_admin mixed public | No description available. |
| $is_attachment mixed public | No description available. |
| $is_singular mixed public | No description available. |
| $is_robots mixed public | No description available. |
| $is_favicon mixed public | No description available. |
| $is_posts_page mixed public | No description available. |
| $is_post_type_archive mixed public | No description available. |
| $query_vars_hash mixed public | No description available. |
| $query_vars_changed mixed public | No description available. |
| $thumbnails_cached mixed public | No description available. |
| $allow_query_attachment_by_filename mixed public | No description available. |
| $stopwords mixed public | No description available. |
| $compat_fields mixed public | No description available. |
| $compat_methods mixed public | No description available. |
| $query_cache_key mixed public | No description available. |