WordPress Taxonomy based off of WordPress revision 8782.

since 2.3.0
package WordPress

 Methods

WP_Taxonomy()

WP_Taxonomy($db) 

Parameters

$db

PHP5 constructor - Assigns the database to an attribute of the class.

__construct(\unknown_type $db) 

Parameters

$db

\unknown_type

Does nothing.

__destruct() 
package BackPress
subpackage Taxonomy

Get the subset of $terms that are descendants of $term_id.

_get_term_children(integer $term_id, array $terms, string $taxonomy) : array

If $terms is an array of objects, then _get_term_children returns an array of objects. If $terms is an array of IDs, then _get_term_children returns an array of IDs.

package WordPress
subpackage Taxonomy
access private
since 2.3.0

Parameters

$term_id

integer

The ancestor term: all returned terms should be descendants of $term_id.

$terms

array

The set of terms---either an array of term objects or term IDs---from which those that are descendants of $term_id will be chosen.

$taxonomy

string

The taxonomy which determines the hierarchy of the terms.

Returns

arrayThe subset of $terms that are descendants of $term_id.

Retrieves children of taxonomy as Term IDs.

_get_term_hierarchy(string $taxonomy) : array
package WordPress
subpackage Taxonomy
access private
since 2.3.0
uses Stores all of the children in "$taxonomy_children" option. That is the name of the taxonomy, immediately followed by '_children'.

Parameters

$taxonomy

string

Taxonomy Name

Returns

arrayEmpty if $taxonomy isn't hierarachical or returns children as Term IDs.

Add count of children to parent count.

_pad_term_counts(array $terms, string $taxonomy) : null

Recalculates term counts by including items from child terms. Assumes all relevant children are already in the $terms argument.

package WordPress
subpackage Taxonomy
access private
since 2.3

Parameters

$terms

array

List of Term IDs

$taxonomy

string

Term Context

Returns

nullWill break from function if conditions are not met.

Removes the taxonomy relationship to terms from the cache.

clean_object_term_cache(integer|array $object_ids, string $object_type) 

Will remove the entire taxonomy relationship containing term $object_id. The term IDs have to exist within the taxonomy $object_type for the deletion to take place.

package WordPress
subpackage Taxonomy
since 2.3
see for more on $object_type
uses Will call action hook named, 'clean_object_term_cache' after completion. Passes, function params in same order.

Parameters

$object_ids

integerarray

Single or list of term object ID(s)

$object_type

string

The taxonomy object type

Will remove all of the term ids from the cache.

clean_term_cache(integer|array $ids, string $taxonomy = ''
package WordPress
subpackage Taxonomy
since 2.3.0

Parameters

$ids

integerarray

Single or list of Term IDs

$taxonomy

string

Can be empty and will assume tt_ids, else will use for context.

Count how many terms are in Taxonomy.

count_terms(string $taxonomy, array|string $args = array()) : integer

Default $args is 'ignore_empty' which can be 'ignore_empty=true' or array('ignore_empty' => true);.

package WordPress
subpackage Taxonomy
since 2.3.0
uses Turns strings into arrays and merges defaults into an array.

Parameters

$taxonomy

string

Taxonomy name

$args

arraystring

Overwrite defaults

Returns

integerHow many terms are in $taxonomy

Enable or disable term counting.

defer_term_counting(boolean $defer = NULL) : boolean
since 2.5.0

Parameters

$defer

boolean

Optional. Enable if true, disable if false.

Returns

booleanWhether term counting is enabled or disabled.

delete_children_cache()

delete_children_cache($taxonomy) 

Parameters

$taxonomy

Will unlink the term from the taxonomy.

delete_object_term_relationships(integer $object_id, $taxonomies) 

Will remove the term's relationship to the taxonomy, not the term or taxonomy itself. The term and taxonomy will still exist. Will require the term's object ID to perform the operation.

package WordPress
subpackage Taxonomy
since 2.3.0

Parameters

$object_id

integer

The term Object Id that refers to the term

$taxonomies

Removes a term from the database.

delete_term(integer $term, string $taxonomy, array|string $args = array()) : boolean | \WP_Error

If the term is a parent of other terms, then the children will be updated to that term's parent.

The $args 'default' will only override the terms found, if there is only one term found. Any other and the found terms are used.

The $args 'force_default' will force the term supplied as default to be assigned even if the object was not going to be termless

package WordPress
subpackage Taxonomy
since 2.3.0
uses Calls both 'delete_term' and 'delete_$taxonomy' action hooks, passing term object, term id. 'delete_term' gets an additional parameter with the $taxonomy parameter.

Parameters

$term

integer

Term ID

$taxonomy

string

Taxonomy Name

$args

arraystring

Optional. Change 'default' term id and override found term ids.

Returns

boolean\WP_ErrorReturns false if not term; true if completes delete action.

format_to_edit()

format_to_edit($text) 

Parameters

$text

get_children_cache()

get_children_cache($taxonomy) 

Parameters

$taxonomy

Return all of the taxonomy names that are of $object_type.

get_object_taxonomies(array|string|object $object_type) : array

It appears that this function can be used to find all of the names inside of $this->taxonomies variable.

<?php $taxonomies = $this->get_object_taxonomies('post'); ?> Should result in Array('category', 'post_tag')

package WordPress
subpackage Taxonomy
since 2.3.0
uses

Parameters

$object_type

arraystringobject

Name of the type of taxonomy object, or an object (row from posts)

Returns

arrayThe names of all taxonomy of $object_type.

Retrieves the taxonomy relationship to the term object id.

get_object_term_cache(integer|array $id, string $taxonomy) : boolean | array
package WordPress
subpackage Taxonomy
since 2.3.0
uses Retrieves taxonomy relationship from cache

Parameters

$id

integerarray

Term object ID

$taxonomy

string

Taxonomy Name

Returns

booleanarrayEmpty array if $terms found, but not $taxonomy. False if nothing is in cache for $taxonomy and $id.

Retrieves the terms associated with the given object(s), in the supplied taxonomies.

get_object_terms($object_ids, string|array $taxonomies, array|string $args = array()) : array | \WP_Error

The following information has to do the $args parameter and for what can be contained in the string or array of that parameter, if it exists.

The first argument is called, 'orderby' and has the default value of 'name'. The other value that is supported is 'count'.

The second argument is called, 'order' and has the default value of 'ASC'. The only other value that will be acceptable is 'DESC'.

The final argument supported is called, 'fields' and has the default value of 'all'. There are multiple other options that can be used instead. Supported values are as follows: 'all', 'ids', 'names', and finally 'all_with_object_id'.

The fields argument also decides what will be returned. If 'all' or 'all_with_object_id' is choosen or the default kept intact, then all matching terms objects will be returned. If either 'ids' or 'names' is used, then an array of all matching term ids or term names will be returned respectively.

package WordPress
subpackage Taxonomy
since 2.3.0

Parameters

$object_ids

$taxonomies

stringarray

The taxonomies to retrieve terms from.

$args

arraystring

Change what is returned

Returns

array\WP_ErrorThe requested term data or empty array if no terms found. WP_Error if $taxonomy does not exist.

Retrieve object_ids of valid taxonomy and term.

get_objects_in_term(string|array $terms, string|array $taxonomies, array|string $args = null) : \WP_Error | array

The strings of $taxonomies must exist before this function will continue. On failure of finding a valid taxonomy, it will return an WP_Error class, kind of like Exceptions in PHP 5, except you can't catch them. Even so, you can still test for the WP_Error class and get the error message.

The $terms aren't checked the same as $taxonomies, but still need to exist for $object_ids to be returned.

It is possible to change the order that object_ids is returned by either using PHP sort family functions or using the database by using $args with either ASC or DESC array. The value should be in the key named 'order'.

package WordPress
subpackage Taxonomy
since 2.3.0
uses Creates an array from string $args.

Parameters

$terms

stringarray

String of term or array of string values of terms that will be used

$taxonomies

stringarray

String of taxonomy name or Array of string values of taxonomy names

$args

arraystring

Change the order of the object_ids, either ASC or DESC

Returns

\WP_ErrorarrayIf the taxonomy does not exist, then WP_Error will be returned. On success the array can be empty meaning that there are no $object_ids found or it will return the $object_ids found.

Retrieves the taxonomy object of $taxonomy.

get_taxonomy(string $taxonomy) : object | boolean

The get_taxonomy function will first check that the parameter string given is a taxonomy object and if it is, it will return it.

package WordPress
subpackage Taxonomy
since 2.3.0
uses
uses Checks whether taxonomy exists

Parameters

$taxonomy

string

Name of taxonomy object to return

Returns

objectbooleanThe Taxonomy Object or false if $taxonomy doesn't exist

Get all Term data from database by Term ID.

get_term(integer|object $term, string $taxonomy, string $output = OBJECT, string $filter = 'raw') : mixed | null | \WP_Error

The usage of the get_term function is to apply filters to a term object. It is possible to get a term object from the database before applying the filters.

$term ID must be part of $taxonomy, to get from the database. Failure, might be able to be captured by the hooks. Failure would be the same value as $this->db returns for the get_row method.

There are two hooks, one is specifically for each term, named 'getterm', and the second is for the taxonomy name, 'term$taxonomy'. Both hooks gets the term object, and the taxonomy name as parameters. Both hooks are expected to return a Term object.

'get_term' hook - Takes two parameters the term Object and the taxonomy name. Must return term object. Used in get_term() as a catch-all filter for every $term.

'get_$taxonomy' hook - Takes two parameters the term Object and the taxonomy name. Must return term object. $taxonomy will be the taxonomy name, so for example, if 'category', it would be 'get_category' as the filter name. Useful for custom taxonomies or plugging into default taxonomies.

package WordPress
subpackage Taxonomy
since 2.3.0
uses Cleanses the term based on $filter context before returning.
see The $context param lists the available values for get_term_by() $filter param.

Parameters

$term

integerobject

If integer, will get from database. If object will apply filters and return $term.

$taxonomy

string

Taxonomy name that $term is part of.

$output

string

Constant OBJECT, ARRAY_A, or ARRAY_N

$filter

string

Optional, default is raw or no WordPress defined filter will applied.

Returns

mixednull\WP_ErrorTerm Row from database. Will return null if $term is empty. If taxonomy does not exist then WP_Error will be returned.

Get all Term data from database by Term field and data.

get_term_by(string $field, string|integer $value, string $taxonomy, string $output = OBJECT, string $filter = 'raw') : mixed

Warning: $value is not escaped for 'name' $field. You must do it yourself, if required.

The default $field is 'id', therefore it is possible to also use null for field, but not recommended that you do so.

If $value does not exist, the return value will be false. If $taxonomy exists and $field and $value combinations exist, the Term will be returned.

package WordPress
subpackage Taxonomy
since 2.3.0
uses Cleanses the term based on $filter context before returning.
see The $context param lists the available values for get_term_by() $filter param.

Parameters

$field

string

Either 'slug', 'name', 'id', or 'tt_id'

$value

stringinteger

Search for this term value

$taxonomy

string

Taxonomy Name

$output

string

Constant OBJECT, ARRAY_A, or ARRAY_N

$filter

string

Optional, default is raw or no WordPress defined filter will applied.

Returns

mixedTerm Row from database. Will return false if $taxonomy does not exist or $term was not found.

Merge all term children into a single array of their IDs.

get_term_children($term_id, string $taxonomy) : array | \WP_Error

This recursive function will merge all of the children of $term into the same array of term IDs. Only useful for taxonomies which are hierarchical.

Will return an empty array if $term does not exist in $taxonomy.

package WordPress
subpackage Taxonomy
since 2.3.0
uses
uses Used to get the children of both $taxonomy and the parent $term

Parameters

$term_id

$taxonomy

string

Taxonomy Name

Returns

array\WP_ErrorList of Term Objects. WP_Error returned if $taxonomy does not exist

Get sanitized Term field.

get_term_field(string $field, integer $term, string $taxonomy, string $context = 'display') : mixed

Does checks for $term, based on the $taxonomy. The function is for contextual reasons and for simplicity of usage. See sanitize_term_field() for more information.

package WordPress
subpackage Taxonomy
since 2.3.0
uses Passes the return value in sanitize_term_field on success.

Parameters

$field

string

Term field to fetch

$term

integer

Term ID

$taxonomy

string

Taxonomy Name

$context

string

Optional, default is display. Look at sanitize_term_field() for available options.

Returns

mixedWill return an empty string if $term is not an object or if $field is not set in $term.

Sanitizes Term for editing.

get_term_to_edit(integer|object $id, string $taxonomy) : mixed | null | \WP_Error

Return value is sanitize_term() and usage is for sanitizing the term for editing. Function is for contextual and simplicity.

package WordPress
subpackage Taxonomy
since 2.3.0
uses Passes the return value on success

Parameters

$id

integerobject

Term ID or Object

$taxonomy

string

Taxonomy Name

Returns

mixednull\WP_ErrorWill return empty string if $term is not an object.

Retrieve the terms in a given taxonomy or list of taxonomies.

get_terms(string | array $taxonomies, string|array $args = '') : array | \WP_Error

You can fully inject any customizations to the query before it is sent, as well as control the output with a filter.

The 'get_terms' filter will be called when the cache has the term and will pass the found term along with the array of $taxonomies and array of $args. This filter is also called before the array of terms is passed and will pass the array of terms, along with the $taxonomies and $args.

The 'list_terms_exclusions' filter passes the compiled exclusions along with the $args.

The 'get_terms_orderby' filter passes the ORDER BY clause for the query along with the $args array.

The 'get_terms_fields' filter passes the fields for the SELECT query along with the $args array.

The list of arguments that $args can contain, which will overwrite the defaults:

orderby - Default is 'name'. Can be name, count, term_group, slug or nothing (will use term_id), Passing a custom value other than these will cause it to order based on the custom value.

order - Default is ASC. Can use DESC.

hide_empty - Default is true. Will not return empty terms, which means terms whose count is 0 according to the given taxonomy.

exclude - Default is an empty string. A comma- or space-delimited string of term ids to exclude from the return array. If 'include' is non-empty, 'exclude' is ignored.

include - Default is an empty string. A comma- or space-delimited string of term ids to include in the return array.

number - The maximum number of terms to return. Default is empty.

offset - The number by which to offset the terms query.

fields - Default is 'all', which returns an array of term objects. If 'fields' is 'ids' or 'names', returns an array of integers or strings, respectively.

slug - Returns terms whose "slug" matches this value. Default is empty string.

hierarchical - Whether to include terms that have non-empty descendants (even if 'hide_empty' is set to true).

search - Returned terms' names will contain the value of 'search', case-insensitive. Default is an empty string.

namelike - Returned terms' names will begin with the value of 'namelike', case-insensitive. Default is empty string.

The argument 'pad_counts', if set to true will include the quantity of a term's children in the quantity of each term's "count" object variable.

The 'get' argument, if set to 'all' instead of its default empty string, returns terms regardless of ancestry or whether the terms are empty.

The 'child_of' argument, when used, should be set to the integer of a term ID. Its default is 0. If set to a non-zero value, all returned terms will be descendants of that term according to the given taxonomy. Hence 'child_of' is set to 0 if more than one taxonomy is passed in $taxonomies, because multiple taxonomies make term ancestry ambiguous.

The 'parent' argument, when used, should be set to the integer of a term ID. Its default is the empty string '', which has a different meaning from the integer 0. If set to an integer value, all returned terms will have as an immediate ancestor the term whose ID is specified by that integer according to the given taxonomy. The 'parent' argument is different from 'child_of' in that a term X is considered a 'parent' of term Y only if term X is the father of term Y, not its grandfather or great-grandfather, etc.

package WordPress
subpackage Taxonomy
since 2.3.0
uses Merges the defaults with those defined by $args and allows for strings.

Parameters

$taxonomies

stringarray

Taxonomy name or list of Taxonomy names

$args

stringarray

The values of what to search for when returning terms

Returns

array\WP_ErrorList of Term Objects and their children. Will return WP_Error, if any of $taxonomies do not exist.

Adds a new term to the database. Optionally marks it as an alias of an existing term.

insert_term(integer|string $term, string $taxonomy, array|string $args = array()) : array | \WP_Error

Error handling is assigned for the nonexistance of the $taxonomy and $term parameters before inserting. If both the term id and taxonomy exist previously, then an array will be returned that contains the term id and the contents of what is returned. The keys of the array are 'term_id' and 'term_taxonomy_id' containing numeric values.

It is assumed that the term does not yet exist or the above will apply. The term will be first added to the term table and then related to the taxonomy if everything is well. If everything is correct, then several actions will be run prior to a filter and then several actions will be run after the filter is run.

The arguments decide how the term is handled based on the $args parameter. The following is a list of the available overrides and the defaults.

'alias_of'. There is no default, but if added, expected is the slug that the term will be an alias of. Expected to be a string.

'description'. There is no default. If exists, will be added to the database along with the term. Expected to be a string.

'parent'. Expected to be numeric and default is 0 (zero). Will assign value of 'parent' to the term.

'slug'. Expected to be a string. There is no default.

If 'slug' argument exists then the slug will be checked to see if it is not a valid term. If that check succeeds (it is not a valid term), then it is added and the term id is given. If it fails, then a check is made to whether the taxonomy is hierarchical and the parent argument is not empty. If the second check succeeds, the term will be inserted and the term id will be given.

package WordPress
subpackage Taxonomy
since 2.3.0
uses Calls 'create_term' hook with the term id and taxonomy id as parameters.
uses Calls 'create_$taxonomy' hook with term id and taxonomy id as parameters.
uses Calls 'term_id_filter' hook with term id and taxonomy id as parameters.
uses Calls 'created_term' hook with the term id and taxonomy id as parameters.
uses Calls 'created_$taxonomy' hook with term id and taxonomy id as parameters.

Parameters

$term

integerstring

The term to add or update.

$taxonomy

string

The taxonomy to which to add the term

$args

arraystring

Change the values of the inserted term

Returns

array\WP_ErrorThe Term ID and Term Taxonomy ID

Determine if the given object is associated with any of the given terms.

is_object_in_term($object_id, $taxonomy, integer|string|array $terms = null) : boolean | \WP_Error.

The given terms are checked against the object's terms' term_ids, names and slugs. Terms given as integers will only be checked against the object's terms' term_ids. If no terms are given, determines if object is associated with any terms in the given taxonomy.

since 2.7.0
uses
uses

Parameters

$object_id

$taxonomy

$terms

integerstringarray

Optional. Term term_id, name, slug or array of said

Returns

boolean\WP_Error.WP_Error on input error.

Checks that the taxonomy name exists.

is_taxonomy(string $taxonomy) : boolean
package WordPress
subpackage Taxonomy
since 2.3.0
uses

Parameters

$taxonomy

string

Name of taxonomy object

Returns

booleanWhether the taxonomy exists or not.

Whether the taxonomy object is hierarchical.

is_taxonomy_hierarchical(string $taxonomy) : boolean

Checks to make sure that the taxonomy is an object first. Then Gets the object, and finally returns the hierarchical value in the object.

A false return value might also mean that the taxonomy does not exist.

package WordPress
subpackage Taxonomy
since 2.3.0
uses Checks whether taxonomy exists
uses Used to get the taxonomy object

Parameters

$taxonomy

string

Name of taxonomy object

Returns

booleanWhether the taxonomy is hierarchical

Check if Term exists.

is_term(integer|string $term, string $taxonomy = '', integer $parent = 0) : mixed

Returns the index of a defined term, or 0 (false) if the term doesn't exist.

package WordPress
subpackage Taxonomy
since 2.3.0

Parameters

$term

integerstring

The term to check

$taxonomy

string

The taxonomy name to use

$parent

integer

ID of parent term under which to confine the exists search.

Returns

mixedGet the term id or Term Object, if exists.

Create or modify a taxonomy object. Do not use before init.

register_taxonomy(string $taxonomy, string $object_type, array|string $args = array()

A simple function for creating or modifying a taxonomy object based on the parameters given. The function will accept an array (third optional parameter), along with strings for the taxonomy name and another string for the object type.

The function keeps a default set, allowing for the $args to be optional but allow the other functions to still work. It is possible to overwrite the default set, which contains two keys: hierarchical and update_count_callback.

Nothing is returned, so expect error maybe or use is_taxonomy() to check whether taxonomy exists.

Optional $args contents:

hierarachical - has some defined purpose at other parts of the API and is a boolean value.

update_count_callback - works much like a hook, in that it will be called when the count is updated.

package WordPress
subpackage Taxonomy
since 2.3.0
uses Inserts new taxonomy object into the list

Parameters

$taxonomy

string

Name of taxonomy object

$object_type

string

Name of the object type for the taxonomy object.

$args

arraystring

See above description for the two keys values.

Sanitize Term all fields

sanitize_term(array|object $term, string $taxonomy, string $context = 'display') : array | object

Relies on sanitize_term_field() to sanitize the term. The difference is that this function will sanitize all fields. The context is based on sanitize_term_field().

The $term is expected to be either an array or an object.

package WordPress
subpackage Taxonomy
since 2.3.0
uses Used to sanitize all fields in a term

Parameters

$term

arrayobject

The term to check

$taxonomy

string

The taxonomy name to use

$context

string

Default is 'display'.

Returns

arrayobjectTerm with all fields sanitized

Cleanse the field value in the term based on the context.

sanitize_term_field(string $field, string $value, integer $term_id, string $taxonomy, string $context) : mixed

Passing a term field value through the function should be assumed to have cleansed the value for whatever context the term field is going to be used.

If no context or an unsupported context is given, then default filters will be applied.

There are enough filters for each context to support a custom filtering without creating your own filter function. Simply create a function that hooks into the filter you need.

package WordPress
subpackage Taxonomy
since 2.3.0

Parameters

$field

string

Term field to sanitize

$value

string

Search for this term value

$term_id

integer

Term ID

$taxonomy

string

Taxonomy Name

$context

string

Either edit, db, display, attribute, or js.

Returns

mixedsanitized field

sanitize_term_slug()

sanitize_term_slug($title, $taxonomy = '', $term_id = 0

Parameters

$title

$taxonomy

$term_id

set_children_cache()

set_children_cache($taxonomy, $children) 

Parameters

$taxonomy

$children

Create Term and Taxonomy Relationships.

set_object_terms(integer $object_id, $terms, array|string $taxonomy, boolean $append = false) : array | \WP_Error

Relates an object (post, link etc) to a term and taxonomy type. Creates the term and taxonomy relationship if it doesn't already exist. Creates a term if it doesn't exist (using the slug).

A relationship means that the term is grouped in or belongs to the taxonomy. A term has no meaning until it is given context by defining which taxonomy it exists under.

package WordPress
subpackage Taxonomy
since 2.3.0

Parameters

$object_id

integer

The object to relate to.

$terms

$taxonomy

arraystring

The context in which to relate the term to the object.

$append

boolean

If false will delete difference of terms.

Returns

array\WP_ErrorAffected Term IDs

Will make slug unique, if it isn't already.

unique_term_slug(string $slug, object $term) : string

The $slug has to be unique global to every taxonomy, meaning that one taxonomy term can't have a matching slug with another taxonomy term. Each slug has to be globally unique for every taxonomy.

The way this works is that if the taxonomy that the term belongs to is heirarchical and has a parent, it will append that parent to the $slug.

If that still doesn't return an unique slug, then it try to append a number until it finds a number that is truely unique.

The only purpose for $term is for appending a parent, if one exists.

package WordPress
subpackage Taxonomy
since 2.3.0

Parameters

$slug

string

The string that will be tried for a unique slug

$term

object

The term object that the $slug will belong too

Returns

stringWill return a true unique slug.

Updates the cache for Term ID(s).

update_object_term_cache(string|array $object_ids, string $object_type) : null | boolean

Will only update the cache for terms not already cached.

The $object_ids expects that the ids be separated by commas, if it is a string.

It should be noted that update_object_term_cache() is very time extensive. It is advised that the function is not called very often or at least not for a lot of terms that exist in a lot of taxonomies. The amount of time increases for each term and it also increases for each taxonomy the term belongs to.

package WordPress
subpackage Taxonomy
since 2.3.0
uses Used to get terms from the database to update

Parameters

$object_ids

stringarray

Single or list of term object ID(s)

$object_type

string

The taxonomy object type

Returns

nullbooleanNull value is given with empty $object_ids. False if

Update term based on arguments provided.

update_term(integer $term_id, string $taxonomy, array|string $args = array()) : array | \WP_Error

The $args will indiscriminately override all values with the same field name. Care must be taken to not override important information need to update or update will fail (or perhaps create a new term, neither would be acceptable).

Defaults will set 'alias_of', 'description', 'parent', and 'slug' if not defined in $args already.

'alias_of' will create a term group, if it doesn't already exist, and update it for the $term.

If the 'slug' argument in $args is missing, then the 'name' in $args will be used. It should also be noted that if you set 'slug' and it isn't unique then a WP_Error will be passed back. If you don't pass any slug, then a unique one will be created for you.

For what can be overrode in $args, check the term scheme can contain and stay away from the term keys.

package WordPress
subpackage Taxonomy
since 2.3.0
uses Will call both 'edit_term' and 'edit_$taxonomy' twice.
uses Will call the 'term_id_filter' filter and pass the term id and taxonomy id.

Parameters

$term_id

integer

The ID of the term

$taxonomy

string

The context in which to relate the term to the object.

$args

arraystring

Overwrite term field values

Returns

array\WP_ErrorReturns Term ID and Taxonomy Term ID

Updates Terms to Taxonomy in cache.

update_term_cache(array $terms, string $taxonomy = ''
package WordPress
subpackage Taxonomy
since 2.3.0

Parameters

$terms

array

List of Term objects to change

$taxonomy

string

Optional. Update Term to this taxonomy in cache

Updates the amount of terms in taxonomy.

update_term_count(integer|array $terms, string $taxonomy, $do_deferred = false) : boolean

If there is a taxonomy callback applied, then it will be called for updating the count.

The default action is to count what the amount of terms have the relationship of term ID. Once that is done, then update the database.

package WordPress
subpackage Taxonomy
since 2.3.0
uses

Parameters

$terms

integerarray

The ID of the terms

$taxonomy

string

The context of the term.

$do_deferred

Returns

booleanIf no terms will return false, and if successful will return true.

Perform term count update immediately.

update_term_count_now(array $terms, string $taxonomy) : boolean
since 2.5.0

Parameters

$terms

array

The term_taxonomy_id of terms to update.

$taxonomy

string

The context of the term.

Returns

booleanAlways true when complete.

 Properties

 

Stores the database.

$db : \unknown_type

Default

 

$taxonomies

$taxonomies 

Default

array()