Queries (category)

get_page_by_title()

Retrieve any type of post (page, post, custom type) by given title.

get_post()

Gets the data of the current or specified post. You need to specify post ID, or the function will return the current post. Returns a WP_Post object.

get_posts()

Gets an array of posts (pages, attachments, custom post types) from the database. You can specify any criteria for getting the posts.

have_posts()

Checks if global $wp_query has posts to process. Conditional tag.

in_the_loop()

Determines whether the caller is in The Loop (i.e. whether the loop is currently active). A conditional tag that is used to execute code only inside The Loop.

is_404()

Checks whether the 404 error page is displayed (HTTP 404: page not found). Conditional tag.

is_archive()

Conditional tag. Return true when any of the archive pages are shown (Year, Category, Author, Post Type archive...).

is_attachment()

Checks if the current page is an attachment page. Conditional Tag.

is_author()

Checks if the author's posts page is displayed. You can specify a specific author. Conditional tag.

is_category()

Conditional tag. Checks whether the category page is displayed or not.

is_date()

Determines whether the date archive page is displayed. Conditional tag.

is_day()

Determines whether a day archive page is shown (example.com/2009/08/05) — page with posts for a specific day. A conditional tag.

is_feed()

Checks if a feed is being requested at the current moment.

is_front_page()

Checks whether the main (home) page of the site is displayed. Conditional tag.

is_home()

Checks whether the page showing posts is being displayed, usually this is the site's front page. Conditional tag.

is_main_query()

Checks if the action is being executed in the main WordPress loop. Conditional tag.

is_month()

Determines whether a monthly archive page is shown (example.com/2009/08) — page with posts for a specific month. A conditional tag.

is_new_day()

Checking the difference between the current date and the previous one (in a loop). Conditional tag.

is_page()

Checks whether a "static page" is displaying. You can specify an ID, name, or page title to check a specific page. Conditional tag.

is_paged()

Checks whether the pagination page is displayed (page type /page/2, /page/3). Conditional tag.

is_preview()

Check if the user is on the post preview page. Conditional tag

is_search()

Works when the search results page is displayed. Conditional tag.

is_single()

Checks whether a post page (of any post type) is displayed. Posts with attachment and page post types will not be checked. Conditional tag.

is_singular()

Checks whether the post page is viewed (post, page, attachment, any post type). Conditional Tag.

is_tag()

Check if the tag archive page is displayed. Conditional tag.

is_tax()

Works on the custom taxonomy archive page. Conditional tag.

is_time()

Determines whether the query is for a time-based archive page (page of posts for the specified time). A conditional tag.

is_year()

Determines whether a year archive page is shown (example.com/2009) — page with posts for a specific year. A conditional tag.

query_posts()

WordPress is used when retrieving posts for the current page (author archive, single post, category, tag).

rewind_posts()

Rewinds the loop to the beginning.

setup_postdata()

Sets up all urgent data of the post (except global $post variable).

the_post()

Sets the next post to the global $post variable. Also sets all post data with setup_postdata().

wp_count_posts()

Gets the number of posts of any post type and any status (publish, draft).

wp_get_recent_posts()

Retrieve the last posts of the website, including drafts, scheduled, and posts on moderation. Gets the last 10 posts only.

wp_reset_postdata()

Restores the global $post variable to the correct state: to correspond the current page.

wp_reset_query()

Invalidates (destroys) the data of the last query created for use in an arbitrary WordPress Loop and restores the default loop data.