Property | Type | Description | |
---|---|---|---|
$cache_domain | string | In WordPress Version 3.2 and above. The 'cache_domain' argument enables a unique cache key to be produced when the query produced by get_terms() is stored in object cache. For instance, if you are using one of this function's filters to modify the query (such as 'terms_clauses'), setting 'cache_domain' to a unique value will not overwrite the cache for similar queries. Default value is 'core'. | |
$child_of | integer | Get all descendents of this term. Default is 0. | |
$exclude | integer | string | array | An array of term ids to exclude. Also accepts a string of comma-separated ids. | |
$exclude_tree | array | An array of parent term ids to exclude | |
$fields | string | all - returns an array of term objects - Default ids - returns an array of integers names - returns an array of strings count - (3.2+) returns the number of terms found id=>parent - returns an associative array where the key is the term id and the value is the parent term id if present or 0 | |
$get | string | Allow for overwriting 'hide_empty' and 'child_of', which can be done by setting the value to 'all'. | |
$hide_empty | boolean | true - Default (i.e. Do not show empty terms) false | |
$hierarchical | boolean | 1 (true) - Default 0 (false) | |
$include | array | An array of term ids to include. Empty returns all. | |
$name__like | string | This matches terms that begin with the 'name__like' string. | |
$number | integer | The maximum number of terms to return. Default is to return them all. | |
$offset | integer | The number by which to offset the terms query. | |
$order | string | ASC - Default DESC | |
$orderby | string | id count name - Default slug term_group - Not fully implemented (avoid using) none | |
$pad_counts | boolean | 1 (true) 0 (false) - Default | |
$parent | integer | Get direct children of this term (only terms whose explicit parent is this value). If 0 is passed, only top-level terms are returned. Default is an empty string. | |
$search | string | This matches terms that contain the 'search' string. | |
$slug | string | Returns terms whose "slug" matches this value. Default is empty string. |
Method | Description | |
---|---|---|
__construct ( string | array $taxonomy = 'category' ) : WPDKTerms | Create an instance of WPDKTerms class | |
breadCrumbs ( integer | object | string $term ) : array | Return the array of term from parent | |
term ( integer | object | string $term ) : WP_Error | WPDKTerm | Return a single term by id, object, name or slug | |
terms ( ) : array | WP_Error | Return an array of term objects | |
tree ( boolean $child_of = false ) : array | WP_Error | Return a tree list of terms. Used to build an indent list of children |
public __construct ( string | array $taxonomy = 'category' ) : WPDKTerms | ||
$taxonomy | string | array | Optional. Single or array of taxonomy ID. Default 'category' |
return | WPDKTerms |
public breadCrumbs ( integer | object | string $term ) : array | ||
$term | integer | object | string | If integer, will get from database. If object will apply filters and return $term. If string started with `%` will get by `get_term_by( 'name' )` Else if string will get by `get_term_by( 'slug' )` |
return | array |
public term ( integer | object | string $term ) : WP_Error | WPDKTerm | ||
$term | integer | object | string | If integer, will get from database. If object will apply filters and return $term. If string started with `%` will get by `get_term_by( 'name' )` Else if string will get by `get_term_by( 'slug' )` |
return | WP_Error | WPDKTerm |
public string $cache_domain | ||
return | string |
public int $child_of | ||
return | integer |
public array $exclude_tree | ||
return | array |
public string $fields | ||
return | string |
public string $get | ||
return | string |
public bool $hide_empty | ||
return | boolean |
public array $include | ||
return | array |
public string $name__like | ||
return | string |
public int $number | ||
return | integer |
public int $offset | ||
return | integer |
public string $orderby | ||
return | string |
public int $parent | ||
return | integer |
public string $search | ||
return | string |
public string $slug | ||
return | string |