query (tag)

esc_sql()

Prepares data for use in a MySQL query. Protects against SQL injections. May accept an array of strings for processing.

get_boundary_post()

Retrieves the first or last post of the site (by publish date).

get_children()

Retrieve all children (attachments, revisions, or sub-pages) of the post parent ID. It works similar to get_posts().

get_page_by_title()

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

get_pages()

Retrieve pages data (or hierarchical post type data) as an array of posts objects. Caches the result in object cache.

get_posts()

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

get_queried_object()

Retrieve the currently-queried object.

get_queried_object_id()

Gets the ID of the current query object. It can be: any post, category, tag, other taxonomy element, author's archive.

get_query_var()

Retrieve variable in the WP_Query class.

have_posts()

Checks if the current WP query has results for output, i.e. if there are posts available for output on the current page. Conditional tag.

like_escape()

Formerly used to escape strings before searching the DB. It was poorly documented and never worked as described.

query_posts()

Sets up The Loop with query parameters.

rewind_posts()

Rewind the loop posts.

set_query_var()

Sets the value of a query variable in the WP_Query class.

setup_postdata()

Set up the global post data. Useful for easy usage of Template Tags related to the design of the post: the_title(), the_permalink(), etc.

wp()

Set up the WordPress query.

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

Retrieve a single post, based on post ID.

WP_Query{}

The WordPress Query class. Selects posts from the database based on the specified parameters. get_posts(), query_posts() and all other query functions for posts selection from wp_posts table are based on this class.

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.

wp_reset_vars()

Resets global variables based on $_GET and $_POST