API / Minn\Runtime / TermQueryRunner

TermQueryRunner final class

Minn\Runtime\TermQueryRunner · public/minn/src/Minn/Runtime/TermQueryRunner.php · 255 lines

WP_Term_Query::get_terms as the reference runs it (probe wp-term-query-sql): the variables parsed and handed to pre_get_terms, get_terms_args, the WHERE pieces (taxonomies, inclusions, exclusions with excluded trees and childless terms through list_terms_exclusions, names, slugs, term taxonomy ids, likes, objects, parent, counts, search, meta), the order through get_terms_orderby, the fields through get_terms_fields, all of it through terms_clauses, terms_pre_query, and the results shaped by TermQueryTree (children, padded counts, the empty hidden, the page).

Constants and properties

privateWP_Term_Query $query
privateobject $wpdb
privatearray $where

Public

methodrun(WP_Term_Query $query, object $wpdb): mixed#

Runs a term query object's variables: its terms in the shape the fields ask for, a count, or what a plugin answered first.

$wpdbobjectthe database object plugins see

Internals 12

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

privatelists(array $args): array#

Names, slugs, term taxonomy ids and object ids as lists, as the reference holds them once plugins have had the arguments.

$argsarray<string, mixed>
@return array<string, mixed>
privatehierarchical(array $args): bool#

Whether the results have a tree to walk (a count never does). @param array<string, mixed> $args

$argsarray<string, mixed>
privatesettle(array $args, array $taxonomies): array#

The variables pre_get_terms left, settled: a flat taxonomy needs no tree, a parent overrides child_of, `get=all` asks for every term; then get_terms_args.

$argsarray<string, mixed>
$taxonomieslist<string>
@return array<string, mixed>
privateinHierarchy(int $parent, array $taxonomies): bool#

Whether a parent or child_of term has children in any of the taxonomies (when none, the query is not run). @param list<string> $taxonomies

$taxonomieslist<string>
privateorder(array $args): array#

The ORDER BY clause and direction, term_order needing the relationships. @param array<string, mixed> $args @return array{0: string, 1: string}

$argsarray<string, mixed>@return array{0: string, 1: string}
privateclauses(array $args, array $taxonomies): void#

The WHERE pieces, by name, in the reference's order. @param array<string, mixed> $args @param list<string> $taxonomies

$argsarray<string, mixed>@param list<string> $taxonomies
privateexclusions(array $args, array $taxonomies): string#

The excluded ids (an excluded term's whole tree, childless terms' parents), unless ids are included. @param array<string, mixed> $args @param list<string> $taxonomies

$argsarray<string, mixed>@param list<string> $taxonomies
privatenames(array $args, array $taxonomies): void#

Names (as saving stores them), slugs and term taxonomy ids. @param array<string, mixed> $args @param list<string> $taxonomies

$argsarray<string, mixed>@param list<string> $taxonomies
privatelikes(array $args): void#
$argsarray<string, mixed>
privateselect(array $args, array $taxonomies, string $orderby, string $order): void#

The rest of the WHERE (counts, search, meta), the fields, the joins, terms_clauses, and the request written from what it returned.

$argsarray<string, mixed>
$taxonomieslist<string>
privatelimits(array $args): string#

A LIMIT only when no tree has to be walked first (the tree's page is cut afterwards). @param array<string, mixed> $args

$argsarray<string, mixed>
privatemeta(): array#

The meta query's join and WHERE piece, read again in case pre_get_terms changed its variables. @return array{0: string, 1: string}

@return array{0: string, 1: string}