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

Sets and Gets the current queried object (complete information about the post, tags, categories, etc.).

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

Gets query variables (query parameters) from WP_Query, which is set in the global variable $wp_query.

have_posts()

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

like_escape()

Use instead of wpdb::esc_like(). Prepares a string for use in a SQL query LIKE expression. Since version 4.0, it is considered deprecated!

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.

set_query_var()

Sets the query parameter in the global variable $wp_query.

setup_postdata()

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

wp()

Sets the main query (WordPress environment).

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

Gets all information about the specified post.

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

Sets the specified variables as global if they are specified in the $_GET / $_POST request.