PostQuery final class
Minn\Runtime\PostQuery · public/minn/src/Minn/Runtime/PostQuery.php · 394 lines
WP_Query::get_posts as the reference runs it (probe wp-query-sql): the variables parsed and handed to pre_get_posts, the clauses written piece by piece, every filter a plugin may change them through in the reference's order (suppress_filters keeps the ones it keeps), the request split into an id query when that is cheaper, the count, a single post's status check and preview, sticky posts on the home listing, and the results filters.
Constants and properties
| private | WP_Query $query | |
| private | object $wpdb | |
| private | Minn\Runtime\PostQueryParts $parts | |
| private | readonly Minn\Db $db | Promoted from the constructor. |
Public
| new | __construct(Minn\Db $db)# | |||||||
| method | run(WP_Query $query, object $wpdb, mixed $urlSearch): mixed# | Runs a query object's variables and fills it in: the posts (or ids, or id => parent), the request, the counts. Returns what get_posts returns.
| ||||||
| method | search(WP_Query $query, array $q, mixed $urlSearch): string# | A search's WHERE fragment, settling the search variables (the terms, how many the string split into, the title matches its order ranks by).
| ||||||
| method | stopwords(): array# | The search stopwords, translated and filtered. @return list<string> @return list<string> |
Internals 13
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | prepare(): void# | Parses the variables, hands them to pre_get_posts, and reads the meta query from them. | |||
| private | defaults(array $q): void# | The defaults get_posts settles before it writes a clause. @param array<string, mixed> $q
| |||
| private | pageSize(array $q): void# | posts_per_page from the option, showposts, an archive's own size or the feed's, and nopaging. @param array<string, mixed> $q
| |||
| private | clauses(array $q, mixed $urlSearch): void# | Writes the clauses, in the reference's order. @param array<string, mixed> $q
| |||
| private | taxonomies(array $q): void# | The tax query's clauses (not for a single post), a taxonomy archive's types, and the compatibility variables. @param array<string, mixed> $q
| |||
| private | searchOrder(array $q): void# | A search's relevance order, ahead of the order asked for, when no other order is asked for. @param array<string, mixed> $q
| |||
| private | filtered(array $q): void# | The clause filters, paging between the first two and the rest, and posts_selection. @param array<string, mixed> $q
| |||
| private | through(array $hooks, string $clausesHook): void# | Each piece through its filter, then all seven through the clauses filter. @param array<string, string> $hooks
| |||
| private | paging(array $q): void# | LIMIT for a listing that pages: the offset when one is given, the page's start otherwise. @param array<string, mixed> $q
| |||
| private | execute(array $q): mixed# | Writes the request, runs it (or takes posts_pre_query's answer), and finishes the results. @param array<string, mixed> $q
| |||
| private | idsOnly(array $q): array# | The ids (or id => parent) a query for them returns. @param array<string, mixed> $q
| |||
| private | select(array $q, string $old, string $foundRows): void# | Runs the request: ids first, then their posts, when the query can be split that way. @param array<string, mixed> $q
| |||
| private | foundPosts(array $q): void# | found_posts (from FOUND_ROWS() when the query paged, else the posts' count) and max_num_pages. @param array<string, mixed> $q
|
Nothing matches.