[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

title

Body

[close]

/wp-includes/ -> class-wp-query.php (summary)

Query API: WP_Query class

File Size: 4369 lines (130 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_Query:: (66 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_search()
  is_single()
  is_singular()
  is_time()
  is_trackback()
  is_year()
  is_404()
  is_embed()
  is_main_query()
  setup_postdata()
  generate_postdata()
  reset_postdata()
  lazyload_term_meta()
  lazyload_comment_meta()


Class: WP_Query  - X-Ref

The WordPress Query class.

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
Reparse the query vars.


fill_query_vars( $array )   X-Ref
Fills in the query variables, which do not exist within the parameter.

return: array Complete query variables with undefined ones filled in empty.
param: array $array Defined query variables.

parse_query( $query = '' )   X-Ref
Parse a query string and set 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.

return: string WHERE clause.
param: array $q Query variables.

parse_search_terms( $terms )   X-Ref
Check 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.

return: array Terms that are not stopwords.
param: string[] $terms Array of terms to check.

get_search_stopwords()   X-Ref
Retrieve stopwords used when parsing search terms.

return: array Stopwords.

parse_search_order( &$q )   X-Ref
Generates SQL for the ORDER BY condition based on passed search terms.

return: string ORDER BY clause.
param: array $q Query variables.

parse_orderby( $orderby )   X-Ref
Converts the given orderby alias (if allowed) to a properly-prefixed value.

return: string|false Table-prefixed value to used in the ORDER clause. False otherwise.
param: string $orderby Alias for the field to order by.

parse_order( $order )   X-Ref
Parse an 'order' query variable and cast it to ASC or DESC as necessary.

return: string The sanitized 'order' query variable.
param: string $order The 'order' query variable.

set_404()   X-Ref
Sets the 404 property and saves whether query is feed.


get( $query_var, $default = '' )   X-Ref
Retrieve query variable.

return: mixed Contents of the query variable.
param: string $query_var Query variable key.
param: mixed  $default   Optional. Value to return if the query variable is not set. Default empty.

set( $query_var, $value )   X-Ref
Set 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
Set 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
Set 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 loop.

rewind_posts()   X-Ref
Rewind the posts and reset post index.


next_comment()   X-Ref
Iterate current comment index and return WP_Comment object.

return: WP_Comment Comment object.

the_comment()   X-Ref
Sets up the current comment.


have_comments()   X-Ref
Whether there are more comments available.

Automatically rewinds comments when finished.

return: bool True, if more comments. False, if no more posts.

rewind_comments()   X-Ref
Rewind the comments, resets the comment index and comment to first.


query( $query )   X-Ref
Sets up the WordPress query by parsing query string.

return: WP_Post[]|int[] Array of post objects or post IDs.
param: string|array $query URL query string or array of query arguments.

get_queried_object()   X-Ref
Retrieve 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: object

get_queried_object_id()   X-Ref
Retrieve ID of the current 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
Make private properties readable for backward compatibility.

return: mixed Property.
param: string $name Property to get.

__isset( $name )   X-Ref
Make private properties checkable for backward compatibility.

return: bool Whether the property is set.
param: string $name Property to check if set.

__call( $name, $arguments )   X-Ref
Make private/protected methods readable for backward compatibility.

return: mixed|false Return value of the callback, false otherwise.
param: string   $name      Method to call.
param: array    $arguments Arguments to pass when calling.

is_archive()   X-Ref
Is the query for an existing archive page?

Month, Year, Category, Author, Post Type archive...

return: bool

is_post_type_archive( $post_types = '' )   X-Ref
Is the query for an existing post type archive page?

return: bool
param: mixed $post_types Optional. Post type or array of posts types to check against.

is_attachment( $attachment = '' )   X-Ref
Is the query for an existing attachment page?

return: bool
param: mixed $attachment Attachment ID, title, slug, or array of such.

is_author( $author = '' )   X-Ref
Is the query 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.

return: bool
param: mixed $author Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames

is_category( $category = '' )   X-Ref
Is the query 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.

return: bool
param: mixed $category Optional. Category ID, name, slug, or array of Category IDs, names, and slugs.

is_tag( $tag = '' )   X-Ref
Is the query 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.

return: bool
param: mixed $tag Optional. Tag ID, name, slug, or array of Tag IDs, names, and slugs.

is_tax( $taxonomy = '', $term = '' )   X-Ref
Is the query 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.

return: bool True for custom taxonomy archive pages, false for built-in taxonomies (category and tag archives).
param: mixed $taxonomy Optional. Taxonomy slug or slugs.
param: mixed $term     Optional. Term ID, name, slug or array of Term IDs, names, and slugs.

is_comments_popup()   X-Ref
Whether the current URL is within the comments popup window.

return: bool

is_date()   X-Ref
Is the query for an existing date archive?

return: bool

is_day()   X-Ref
Is the query for an existing day archive?

return: bool

is_feed( $feeds = '' )   X-Ref
Is the query for a feed?

return: bool
param: string|array $feeds Optional feed types to check.

is_comment_feed()   X-Ref
Is the query for a comments feed?

return: bool

is_front_page()   X-Ref
Is the query 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 True, if front of site.

is_home()   X-Ref
Is the query 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 True if blog view homepage.

is_privacy_policy()   X-Ref
Is the query 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 True, if Privacy Policy page.

is_month()   X-Ref
Is the query for an existing month archive?

return: bool

is_page( $page = '' )   X-Ref
Is the query 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.

return: bool Whether the query is for an existing single page.
param: int|string|array $page Optional. Page ID, title, slug, path, or array of such. Default empty.

is_paged()   X-Ref
Is the query for paged result and not for the first page?

return: bool

is_preview()   X-Ref
Is the query for a post or page preview?

return: bool

is_robots()   X-Ref
Is the query for the robots file?

return: bool

is_search()   X-Ref
Is the query for a search?

return: bool

is_single( $post = '' )   X-Ref
Is the query 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.

return: bool Whether the query is for an existing single post.
param: int|string|array $post Optional. Post ID, title, slug, path, or array of such. Default empty.

is_singular( $post_types = '' )   X-Ref
Is the query 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.

return: bool Whether the query is for an existing single post of any of the given post types.
param: string|array $post_types Optional. Post type or array of post types. Default empty.

is_time()   X-Ref
Is the query for a specific time?

return: bool

is_trackback()   X-Ref
Is the query for a trackback endpoint call?

return: bool

is_year()   X-Ref
Is the query for an existing year archive?

return: bool

is_404()   X-Ref
Is the query a 404 (returns no results)?

return: bool

is_embed()   X-Ref
Is the query for an embedded post?

return: bool

is_main_query()   X-Ref
Is the query the main query?

return: bool

setup_postdata( $post )   X-Ref
Set up global post data.

return: true True when finished.
param: WP_Post|object|int $post WP_Post instance or Post ID/object.

generate_postdata( $post )   X-Ref
Generate post data.

return: array|bool $elements Elements of post or false on failure.
param: WP_Post|object|int $post WP_Post instance or Post ID/object.

reset_postdata()   X-Ref
After looping through a nested query, this function
restores the $post global to the current post in this query.


lazyload_term_meta( $check, $term_id )   X-Ref
Lazyload term meta for posts in the loop.

return: mixed
param: mixed $check
param: int   $term_id

lazyload_comment_meta( $check, $comment_id )   X-Ref
Lazyload comment meta for comments in the loop.

return: mixed
param: mixed $check
param: int   $comment_id



Generated: Fri Oct 25 08:20:01 2019 Cross-referenced by PHPXref 0.7