Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

get_posts()

3 tags 1 category

get_posts() — Retrieves an array of the latest posts, or posts matching the given criteria. For more information on the accepted arguments, see the {

Inputs: $args (array|string): Optional. Array or query string of arguments to retrieve posts. See WP_Query::parse_query() for all available arguments. Field $numberposts (int): Total number of posts to retrieve. Is an alias of $posts_per_page in WP_Query. Accepts -1 for all. Default 5. Field $category (int|string): Category ID or comma-separated list of IDs (this or any children). Is an alias of $cat in WP_Query. Default 0. Field $include (int[]): An array of post IDs to retrieve, sticky posts will be included. Is an alias of $post__in in WP_Query. Default empty array. Field $exclude (int[]): An array of post IDs not to retrieve. Default empty array. Field $suppress_filters (bool): Whether to suppress filters.

Returns WP_Post[]|int[]: Array of post objects or post IDs.

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…