PostQuery
in package
Queries the database for post data.
Retrieves posts of various types.
Tags
Table of Contents
Properties
- $max : int
- The number of posts per page.
- $posts : array<string|int, mixed>
- The result of the post query
Methods
- __construct() : mixed
- Constructor method.
- get_post_ids() : array<string|int, mixed>
- Retrieves post IDs.
Properties
$max
The number of posts per page.
public
int
$max
Defaults to -1 for no limit.
$posts
The result of the post query
public
array<string|int, mixed>
$posts
Methods
__construct()
Constructor method.
public
__construct(string $post_type[, array<string|int, mixed> $args = [] ]) : mixed
Parameters
- $post_type : string
-
The slug of the post type.
- $args : array<string|int, mixed> = []
-
} An optional array of args for the post query.
@array array $meta An associative array of meta keys and values. @string string $compare The compare operator for the meta queries. Defaults to '='. @array array $tax An associative arary of tax names and tags. @int int $max The maximum number of posts to retrieve.}
Tags
get_post_ids()
Retrieves post IDs.
public
get_post_ids() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —An array of post IDs.