API / Minn\Runtime / TermWrites

TermWrites final class

Minn\Runtime\TermWrites · public/minn/src/Minn/Runtime/TermWrites.php · 268 lines

Terms written as WordPress's taxonomy functions write them: a term made, changed and deleted (its children moved up and its default kept), a slug no other term holds, an object's terms set, and the terms' counts kept through the taxonomy's own callback; each step with the actions the reference fires in its order.

Public

staticinsert(mixed $term, mixed $taxonomy, mixed $args = array ( )): mixed#

A new term (wp_insert_term), its fields through their filters in the reference's order (Runtime\TermSave).

staticupdate(mixed $termId, mixed $taxonomy, mixed $args = array ( )): mixed#

A term changed (wp_update_term), its fields through their filters in the reference's order (Runtime\TermSave).

staticdelete(mixed $term, mixed $taxonomy, mixed $args = array ( )): mixed#

A term deleted (wp_delete_term): a taxonomy's default term stays (0); its children move up to its parent, its meta goes row by row, objects left without a category fall back to the default one; false for an unknown term or taxonomy.

staticuniqueSlug(mixed $slug, mixed $term): mixed#

A slug no other term of the taxonomy holds (wp_unique_term_slug): one taken in the taxonomy gets its parents' slugs added, nearest first, until it is free (wp_unique_term_slug_is_bad_slug decides whether it was taken), then "-2", "-3" past any term holding it in any taxonomy.

staticupdateCount(mixed $terms, mixed $taxonomy, mixed $deferred = false): bool#

Terms counted (wp_update_term_count): put off while counting is deferred; asked with $deferred, what was put off is counted now.

staticupdateCountNow(mixed $terms, mixed $taxonomy): bool#

Terms counted now by term_taxonomy id (wp_update_term_count_now) through the taxonomy's count callback, then their caches let go. With no callback of its own, a taxonomy of post types counts published posts; one of other objects counts them all.

staticcountPublished(mixed $terms, mixed $taxonomy): void#

The published objects behind each term_taxonomy id counted (_update_post_term_count); which statuses count is the plugins' to widen.

staticcountAll(mixed $terms, mixed $taxonomy): void#

Every object behind each term_taxonomy id counted, posts or not (_update_generic_term_count).

staticsetObjectTerms(mixed $objectId, mixed $terms, mixed $taxonomy, mixed $append = false): mixed#

An object's terms set (wp_set_object_terms), a term named but not there yet made; added to the ones it had when asked to append. The term_taxonomy ids, or the error making one gave.

staticremoveObjectTerms(mixed $objectId, mixed $terms, mixed $taxonomy): mixed#

Terms taken off an object (wp_remove_object_terms), the ones left counted again; the error for an unknown taxonomy.

staticdeleteObjectRelationships(mixed $objectId, mixed $taxonomies): void#

Every term of the taxonomies taken off an object (wp_delete_object_term_relationships).

Internals 4

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

privateslugUnderParents(string $slug, object $term): string#

A taken slug with the term's parents' slugs added, nearest first, until no term holds it.

privatemoveChildren(Minn\Objects\Term $term, string $taxonomy): void#

What plugins are told as a deleted term's children move up to its parent (the move itself is the term writer's).

privatequery(): Minn\Runtime\TermQuery#
privatewriter(): Minn\Runtime\TermWriter#