API / Minn\Runtime / PostQueryStatus

PostQueryStatus final class

Minn\Runtime\PostQueryStatus · public/minn/src/Minn/Runtime/PostQueryStatus.php · 165 lines

WP_Query's post type and status clause as the reference writes it (probe wp-query-sql). Statuses asked for by name: the type clause, then the statuses (any, less those excluded from search; private kept apart when the query asks for readable posts; the user's own when they may not read or edit others'; an attachment's parent's status for a taxonomy archive). None asked for, on a listing: each queried type, sorted, with its public statuses, the admin list's protected ones in the admin, and private ones the signed-in user may read. A single post: the type clause alone.

Used by 1

Constants and properties

privatereadonly WP_Query $query

Promoted from the constructor.

privatereadonly Minn\Runtime\PostQueryParts $parts

Promoted from the constructor.

Public

new__construct(WP_Query $query, Minn\Runtime\PostQueryParts $parts)#
methodsettleType(): void#

Settles the post type the caps come from: a list of several types has none (its caps are named for multiple_post_type), any other names one.

methodappend(array $q): void#

Appends the type and status clause. @param array<string, mixed> $q

$qarray<string, mixed>

Internals 5

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatetypeWhere(): array#

The type clause, and whether there are no searchable types to give statuses to. @return array{0: string, 1: bool}

@return array{0: string, 1: bool}
privatecap(string $which): string#

The cap a type's object names, or the one its name makes.

privatenamed(mixed $asked, mixed $perm): void#

Statuses asked for by name (or `any`), under the query's perm.

privatelisting(): void#

A listing with no statuses asked for: each type with the statuses its reader may see.

privateprivateStatuses(string $type): string#

The private statuses a signed-in user sees in a type: all of them with the cap to read them, their own otherwise.