File/ptests/samples/omitted/query.php

Description

WordPress Query API

The query API attempts to get which part of WordPress to the user is on. It also provides functionality to getting URL query information.

Classes
Class Description
 class WP_Query The WordPress Query class.
Functions
get_queried_object (line 41)

Retrieve the currently-queried object. Wrapper for $wp_query->get_queried_object()

  • since: 3.1.0
  • access: public
  • uses: WP_Query::get_queried_object
object get_queried_object ()
get_queried_object_id (line 56)

Retrieve ID of the current queried object. Wrapper for $wp_query->get_queried_object_id()

int get_queried_object_id ()
get_query_var (line 24)

Retrieve variable in the WP_Query class.

mixed get_query_var (string $var)
  • string $var: The variable key to retrieve.
have_comments (line 792)

Whether there are comments to loop over.

bool have_comments ()
have_posts (line 731)

Whether current WordPress query has results to loop over.

bool have_posts ()
in_the_loop (line 745)

Whether the caller is in the Loop.

  • return: True if caller is within loop, false if loop hasn't started or ended.
  • since: 2.0.0
  • uses: $wp_query
bool in_the_loop ()
is_404 (line 707)

Is the query a 404 (returns no results)?

bool is_404 ()
is_archive (line 142)

Is the query for an archive page?

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

bool is_archive ()
is_attachment (line 183)

Is the query for an attachment page?

bool is_attachment ()
is_author (line 207)

Is the query for an author archive page?

If the $author parameter is specified, this function will additionally check if the query is for one of the authors specified.

bool is_author ([mixed $author = ''])
  • mixed $author: Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames
is_category (line 231)

Is the query for a category archive page?

If the $category parameter is specified, this function will additionally check if the query is for one of the categories specified.

bool is_category ([mixed $category = ''])
  • mixed $category: Optional. Category ID, name, slug, or array of Category IDs, names, and slugs.
is_comments_popup (line 304)

Whether the current URL is within the comments popup window.

bool is_comments_popup ()
is_comment_feed (line 385)

Is the query for a comments feed?

  • see: WP_Query::is_comments_feed()
  • since: 3.0.0
  • uses: $wp_query
bool is_comment_feed ()
is_date (line 324)

Is the query for a date archive?

bool is_date ()
is_day (line 344)

Is the query for a day archive?

bool is_day ()
is_feed (line 365)

Is the query for a feed?

bool is_feed ([string|array $feeds = ''])
  • string|array $feeds: Optional feed types to check.
is_front_page (line 415)

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 is_home()

bool is_front_page ()
is_home (line 444)

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".

bool is_home ()
is_month (line 464)

Is the query for a month archive?

bool is_month ()
is_page (line 491)

Is the query for a single page?

If the $page parameter is specified, this function will additionally check if the query is for one of the pages specified.

bool is_page ([mixed $page = ''])
  • mixed $page: Page ID, title, slug, or array of such.
is_paged (line 511)

Is the query for paged result and not for the first page?

bool is_paged ()
is_post_type_archive (line 163)

Is the query for a post type archive page?

bool is_post_type_archive ([mixed $post_types = ''])
  • mixed $post_types: Optional. Post type or array of posts types to check against.
is_preview (line 531)

Is the query for a post or page preview?

bool is_preview ()
is_robots (line 551)

Is the query for the robots file?

bool is_robots ()
is_search (line 571)

Is the query for a search?

bool is_search ()
is_single (line 600)

Is the query for a single post?

Works for any post type, except attachments and pages

If the $post parameter is specified, this function will additionally check if the query is for one of the Posts specified.

bool is_single ([mixed $post = ''])
  • mixed $post: Post ID, title, slug, or array of such.
is_singular (line 627)

Is the query for a single post of any post type (post, attachment, page, ... )?

If the $post_types parameter is specified, this function will additionally check if the query is for one of the Posts Types specified.

bool is_singular ([mixed $post_types = ''])
  • mixed $post_types: Optional. Post Type or array of Post Types
is_tag (line 255)

Is the query for a tag archive page?

If the $tag parameter is specified, this function will additionally check if the query is for one of the tags specified.

bool is_tag ([mixed $slug = ''])
  • mixed $slug: Optional. Tag slug or array of slugs.
is_tax (line 284)

Is the query for a 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.

bool is_tax ([mixed $taxonomy = ''], [mixed $term = ''])
  • mixed $taxonomy: Optional. Taxonomy slug or slugs.
  • mixed $term: Optional. Term ID, name, slug or array of Term IDs, names, and slugs.
is_time (line 647)

Is the query for a specific time?

bool is_time ()
is_trackback (line 667)

Is the query for a trackback endpoint call?

bool is_trackback ()
is_year (line 687)

Is the query for a specific year?

bool is_year ()
query_posts (line 90)

Set up The Loop with query parameters.

This will override the current WordPress Loop and shouldn't be used more than once. This must not be used within the WordPress Loop.

  • return: List of posts
  • since: 1.5.0
  • uses: $wp_query
array &query_posts (string $query)
  • string $query
rewind_posts (line 760)

Rewind the loop posts.

null rewind_posts ()
setup_postdata (line 3541)

Set up global post data.

  • return: True when finished.
  • since: 1.5.0
  • uses: do_action_ref_array() - Calls 'the_post'
bool setup_postdata (object $post)
  • object $post: Post data.
set_query_var (line 72)

Set query variable.

null set_query_var (string $var, mixed $value)
  • string $var: Query variable key.
  • mixed $value
the_comment (line 806)

Iterate comment index in the comment loop.

object the_comment ()
the_post (line 773)

Iterate the post index in the loop.

void the_post ()
wp_old_slug_redirect (line 3483)

Redirect old slugs to the correct permalink.

Attempts to find the current slug from the past slugs.

  • return: If no link is found, null is returned.
  • since: 2.1.0
  • uses: $wp_query
  • uses: $wpdb
null wp_old_slug_redirect ()
wp_reset_postdata (line 119)

After looping through a separate query, this function restores the $post global to the current post in the main query

  • since: 3.0.0
  • uses: $wp_query
void wp_reset_postdata ()
wp_reset_query (line 106)

Destroy the previous query and set up a new query.

This should be used after query_posts() and before another query_posts(). This will remove obscure bugs that occur when the previous wp_query object is not destroyed properly before another is set up.

  • since: 2.3.0
  • uses: $wp_query
void wp_reset_query ()

Documentation generated on Thu, 29 Sep 2011 01:44:46 +0530 by phpDocumentor 1.4.3