API / Minn\Runtime / TermQueryTree

TermQueryTree final class

Minn\Runtime\TermQueryTree · public/minn/src/Minn/Runtime/TermQueryTree.php · 146 lines

What a term query does with its rows, as the reference does it (probe wp-term-query-sql): each row a term through get_term (with the object id a relationship query carries); only child_of's descendants; counts padded with the children's posts; an empty term kept only while one of its children has posts (the rest dropped where they stood, keys and all); a tree's page cut once the tree is walked; then the shape the fields ask for.

Uses 1

Constants and properties

privatereadonly array $taxonomies

Promoted from the constructor.

Public

new__construct(array $taxonomies)#
$taxonomieslist<string>
staticpopulate(array $rows): array#

The terms the rows name, keyed as the rows were.

$rowsarray<array-key, object>
@return array<array-key, \WP_Term>
methodsettle(array $terms, array $args): array#

The terms after the tree has had its say: descendants only, padded counts, empty branches dropped, the page cut.

$termsarray<array-key, \WP_Term>
$argsarray<string, mixed>
@return array<array-key, \WP_Term>
staticpad(array $terms, string $taxonomy): void#

Each term's count raised to the published posts in it or under it, as _pad_term_counts does for a hierarchical taxonomy.

$termsarray<array-key, \WP_Term>
staticformat(array $terms, string $fields): array#

The terms in the shape the fields ask for.

$termsarray<array-key, \WP_Term>
@return array<array-key, mixed>

Internals 1

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

privatehasPosts(WP_Term $term): bool#

Whether a term, or one of its children, has posts.