[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
Query API: WP_Query class
File Size: | 4991 lines (154 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
WP_Query:: (68 methods):
init_query_flags()
init()
parse_query_vars()
fill_query_vars()
parse_query()
parse_tax_query()
parse_search()
parse_search_terms()
get_search_stopwords()
parse_search_order()
parse_orderby()
parse_order()
set_404()
get()
set()
get_posts()
set_found_posts()
next_post()
the_post()
have_posts()
rewind_posts()
next_comment()
the_comment()
have_comments()
rewind_comments()
query()
get_queried_object()
get_queried_object_id()
__construct()
__get()
__isset()
__call()
is_archive()
is_post_type_archive()
is_attachment()
is_author()
is_category()
is_tag()
is_tax()
is_comments_popup()
is_date()
is_day()
is_feed()
is_comment_feed()
is_front_page()
is_home()
is_privacy_policy()
is_month()
is_page()
is_paged()
is_preview()
is_robots()
is_favicon()
is_search()
is_single()
is_singular()
is_time()
is_trackback()
is_year()
is_404()
is_embed()
is_main_query()
setup_postdata()
generate_postdata()
generate_cache_key()
reset_postdata()
lazyload_term_meta()
lazyload_comment_meta()
init_query_flags() X-Ref |
Resets query flags to false. The query flags are what page info WordPress was able to figure out. |
init() X-Ref |
Initiates object properties and sets default values. |
parse_query_vars() X-Ref |
Reparses the query vars. |
fill_query_vars( $query_vars ) X-Ref |
Fills in the query variables, which do not exist within the parameter. param: array $query_vars Defined query variables. return: array Complete query variables with undefined ones filled in empty. |
parse_query( $query = '' ) X-Ref |
Parses a query string and sets query type booleans. param: string|array $query { |
parse_tax_query( &$q ) X-Ref |
Parses various taxonomy related query vars. For BC, this method is not marked as protected. See [28987]. param: array $q The query variables. Passed by reference. |
parse_search( &$q ) X-Ref |
Generates SQL for the WHERE clause based on passed search terms. param: array $q Query variables. return: string WHERE clause. |
parse_search_terms( $terms ) X-Ref |
Checks if the terms are suitable for searching. Uses an array of stopwords (terms) that are excluded from the separate term matching when searching for posts. The list of English stopwords is the approximate search engines list, and is translatable. param: string[] $terms Array of terms to check. return: string[] Terms that are not stopwords. |
get_search_stopwords() X-Ref |
Retrieves stopwords used when parsing search terms. return: string[] Stopwords. |
parse_search_order( &$q ) X-Ref |
Generates SQL for the ORDER BY condition based on passed search terms. param: array $q Query variables. return: string ORDER BY clause. |
parse_orderby( $orderby ) X-Ref |
Converts the given orderby alias (if allowed) to a properly-prefixed value. param: string $orderby Alias for the field to order by. return: string|false Table-prefixed value to used in the ORDER clause. False otherwise. |
parse_order( $order ) X-Ref |
Parse an 'order' query variable and cast it to ASC or DESC as necessary. param: string $order The 'order' query variable. return: string The sanitized 'order' query variable. |
set_404() X-Ref |
Sets the 404 property and saves whether query is feed. |
get( $query_var, $default_value = '' ) X-Ref |
Retrieves the value of a query variable. param: string $query_var Query variable key. param: mixed $default_value Optional. Value to return if the query variable is not set. return: mixed Contents of the query variable. |
set( $query_var, $value ) X-Ref |
Sets the value of a query variable. param: string $query_var Query variable key. param: mixed $value Query variable value. |
get_posts() X-Ref |
Retrieves an array of posts based on query variables. There are a few filters and actions that can be used to modify the post database query. return: WP_Post[]|int[] Array of post objects or post IDs. |
set_found_posts( $q, $limits ) X-Ref |
Sets up the amount of found posts and the number of pages (if limit clause was used) for the current query. param: array $q Query variables. param: string $limits LIMIT clauses of the query. |
next_post() X-Ref |
Sets up the next post and iterate current post index. return: WP_Post Next post. |
the_post() X-Ref |
Sets up the current post. Retrieves the next post, sets up the post, sets the 'in the loop' property to true. |
have_posts() X-Ref |
Determines whether there are more posts available in the loop. Calls the {@see 'loop_end'} action when the loop is complete. return: bool True if posts are available, false if end of the loop. |
rewind_posts() X-Ref |
Rewinds the posts and resets post index. |
next_comment() X-Ref |
Iterates current comment index and returns WP_Comment object. return: WP_Comment Comment object. |
the_comment() X-Ref |
Sets up the current comment. |
have_comments() X-Ref |
Determines whether there are more comments available. Automatically rewinds comments when finished. return: bool True if comments are available, false if no more comments. |
rewind_comments() X-Ref |
Rewinds the comments, resets the comment index and comment to first. |
query( $query ) X-Ref |
Sets up the WordPress query by parsing query string. param: string|array $query URL query string or array of query arguments. return: WP_Post[]|int[] Array of post objects or post IDs. |
get_queried_object() X-Ref |
Retrieves the currently queried object. If queried object is not set, then the queried object will be set from the category, tag, taxonomy, posts page, single post, page, or author query variable. After it is set up, it will be returned. return: WP_Term|WP_Post_Type|WP_Post|WP_User|null The queried object. |
get_queried_object_id() X-Ref |
Retrieves the ID of the currently queried object. return: int |
__construct( $query = '' ) X-Ref |
Constructor. Sets up the WordPress query, if parameter is not empty. param: string|array $query URL query string or array of vars. |
__get( $name ) X-Ref |
Makes private properties readable for backward compatibility. param: string $name Property to get. return: mixed Property. |
__isset( $name ) X-Ref |
Makes private properties checkable for backward compatibility. param: string $name Property to check if set. return: bool Whether the property is set. |
__call( $name, $arguments ) X-Ref |
Makes private/protected methods readable for backward compatibility. param: string $name Method to call. param: array $arguments Arguments to pass when calling. return: mixed|false Return value of the callback, false otherwise. |
is_archive() X-Ref |
Determines whether the query is for an existing archive page. Archive pages include category, tag, author, date, custom post type, and custom taxonomy based archives. return: bool Whether the query is for an existing archive page. |
is_post_type_archive( $post_types = '' ) X-Ref |
Determines whether the query is for an existing post type archive page. param: string|string[] $post_types Optional. Post type or array of posts types return: bool Whether the query is for an existing post type archive page. |
is_attachment( $attachment = '' ) X-Ref |
Determines whether the query is for an existing attachment page. param: int|string|int[]|string[] $attachment Optional. Attachment ID, title, slug, or array of such return: bool Whether the query is for an existing attachment page. |
is_author( $author = '' ) X-Ref |
Determines whether the query is for an existing author archive page. If the $author parameter is specified, this function will additionally check if the query is for one of the authors specified. param: int|string|int[]|string[] $author Optional. User ID, nickname, nicename, or array of such return: bool Whether the query is for an existing author archive page. |
is_category( $category = '' ) X-Ref |
Determines whether the query is for an existing category archive page. If the $category parameter is specified, this function will additionally check if the query is for one of the categories specified. param: int|string|int[]|string[] $category Optional. Category ID, name, slug, or array of such return: bool Whether the query is for an existing category archive page. |
is_tag( $tag = '' ) X-Ref |
Determines whether the query is for an existing tag archive page. If the $tag parameter is specified, this function will additionally check if the query is for one of the tags specified. param: int|string|int[]|string[] $tag Optional. Tag ID, name, slug, or array of such return: bool Whether the query is for an existing tag archive page. |
is_tax( $taxonomy = '', $term = '' ) X-Ref |
Determines whether the query is for an existing custom taxonomy archive page. If the $taxonomy parameter is specified, this function will additionally check if the query is for that specific $taxonomy. If the $term parameter is specified in addition to the $taxonomy parameter, this function will additionally check if the query is for one of the terms specified. param: string|string[] $taxonomy Optional. Taxonomy slug or slugs to check against. param: int|string|int[]|string[] $term Optional. Term ID, name, slug, or array of such return: bool Whether the query is for an existing custom taxonomy archive page. |
is_comments_popup() X-Ref |
Determines whether the current URL is within the comments popup window. return: false Always returns false. |
is_date() X-Ref |
Determines whether the query is for an existing date archive. return: bool Whether the query is for an existing date archive. |
is_day() X-Ref |
Determines whether the query is for an existing day archive. return: bool Whether the query is for an existing day archive. |
is_feed( $feeds = '' ) X-Ref |
Determines whether the query is for a feed. param: string|string[] $feeds Optional. Feed type or array of feed types return: bool Whether the query is for a feed. |
is_comment_feed() X-Ref |
Determines whether the query is for a comments feed. return: bool Whether the query is for a comments feed. |
is_front_page() X-Ref |
Determines whether the query is for the front page of the site. This is for what is displayed at your site's main URL. Depends on the site's "Front page displays" Reading Settings 'show_on_front' and 'page_on_front'. If you set a static page for the front page of your site, this function will return true when viewing that page. Otherwise the same as {@see WP_Query::is_home()}. return: bool Whether the query is for the front page of the site. |
is_home() X-Ref |
Determines whether the query is for the blog homepage. This is the page which shows the time based blog content of your site. Depends on the site's "Front page displays" Reading Settings 'show_on_front' and 'page_for_posts'. If you set a static page for the front page of your site, this function will return true only on the page you set as the "Posts page". return: bool Whether the query is for the blog homepage. |
is_privacy_policy() X-Ref |
Determines whether the query is for the Privacy Policy page. This is the page which shows the Privacy Policy content of your site. Depends on the site's "Change your Privacy Policy page" Privacy Settings 'wp_page_for_privacy_policy'. This function will return true only on the page you set as the "Privacy Policy page". return: bool Whether the query is for the Privacy Policy page. |
is_month() X-Ref |
Determines whether the query is for an existing month archive. return: bool Whether the query is for an existing month archive. |
is_page( $page = '' ) X-Ref |
Determines whether the query is for an existing single page. If the $page parameter is specified, this function will additionally check if the query is for one of the pages specified. param: int|string|int[]|string[] $page Optional. Page ID, title, slug, path, or array of such return: bool Whether the query is for an existing single page. |
is_paged() X-Ref |
Determines whether the query is for a paged result and not for the first page. return: bool Whether the query is for a paged result. |
is_preview() X-Ref |
Determines whether the query is for a post or page preview. return: bool Whether the query is for a post or page preview. |
is_robots() X-Ref |
Determines whether the query is for the robots.txt file. return: bool Whether the query is for the robots.txt file. |
is_favicon() X-Ref |
Determines whether the query is for the favicon.ico file. return: bool Whether the query is for the favicon.ico file. |
is_search() X-Ref |
Determines whether the query is for a search. return: bool Whether the query is for a search. |
is_single( $post = '' ) X-Ref |
Determines whether the query is for an existing single post. Works for any post type excluding pages. If the $post parameter is specified, this function will additionally check if the query is for one of the Posts specified. param: int|string|int[]|string[] $post Optional. Post ID, title, slug, path, or array of such return: bool Whether the query is for an existing single post. |
is_singular( $post_types = '' ) X-Ref |
Determines whether the query is for an existing single post of any post type (post, attachment, page, custom post types). If the $post_types parameter is specified, this function will additionally check if the query is for one of the Posts Types specified. param: string|string[] $post_types Optional. Post type or array of post types return: bool Whether the query is for an existing single post |
is_time() X-Ref |
Determines whether the query is for a specific time. return: bool Whether the query is for a specific time. |
is_trackback() X-Ref |
Determines whether the query is for a trackback endpoint call. return: bool Whether the query is for a trackback endpoint call. |
is_year() X-Ref |
Determines whether the query is for an existing year archive. return: bool Whether the query is for an existing year archive. |
is_404() X-Ref |
Determines whether the query is a 404 (returns no results). return: bool Whether the query is a 404 error. |
is_embed() X-Ref |
Determines whether the query is for an embedded post. return: bool Whether the query is for an embedded post. |
is_main_query() X-Ref |
Determines whether the query is the main query. return: bool Whether the query is the main query. |
setup_postdata( $post ) X-Ref |
Sets up global post data. param: WP_Post|object|int $post WP_Post instance or Post ID/object. return: true True when finished. |
generate_postdata( $post ) X-Ref |
Generates post data. param: WP_Post|object|int $post WP_Post instance or Post ID/object. return: array|false Elements of post or false on failure. |
generate_cache_key( array $args, $sql ) X-Ref |
Generates cache key. param: array $args Query arguments. param: string $sql SQL statement. return: string Cache key. |
reset_postdata() X-Ref |
No description |
lazyload_term_meta( $check, $term_id ) X-Ref |
Lazyloads term meta for posts in the loop. param: mixed $check param: int $term_id return: mixed |
lazyload_comment_meta( $check, $comment_id ) X-Ref |
Lazyloads comment meta for comments in the loop. param: mixed $check param: int $comment_id return: mixed |
Generated : Thu Nov 21 08:20:01 2024 | Cross-referenced by PHPXref |