Clarkson_Term
in package
Object oriented wrapper for WP_Term objects.
Table of Contents
- __construct() : mixed
- Clarkson_Term constructor.
- __get() : mixed
- Check if an existing field is requested.
- add_meta() : bool|int|WP_Error
- Update meta data.
- delete_meta() : bool
- Delete meta data.
- get() : Clarkson_Term|null
- Alias of `get_by_id()`.
- get_by_id() : Clarkson_Term|null
- Get term by id.
- get_by_name() : Clarkson_Term|null
- Get term by name.
- get_by_slug() : null|Clarkson_Term
- Get term by slug.
- get_description() : string
- Get the term description.
- get_id() : int
- Get the id of the term.
- get_many() : array<string|int, Clarkson_Term>
- Get multiple terms as Clarkson Objects.
- get_meta() : string|array<string|int, mixed>
- Get term meta data by id.
- get_name() : string
- Get the term name.
- get_one() : Clarkson_Term|null
- Gets the first result from a `::get_many()` query.
- get_parent() : Clarkson_Term|null
- Get the term parent.
- get_permalink() : string|WP_Error
- Get the term permalink.
- get_slug() : string
- Get the term slug.
- get_taxonomy() : string
- Get the taxonomy.
- get_taxonomy_object() : Clarkson_Taxonomy|null
- Get the term's taxonomy object.
- get_term() : WP_Term
- Get the term data.
- get_term_taxonomy_id() : int
- Get the taxonomy id.
- is_queried_object() : bool
- Check if this term was used in the global $wp_query.
- set_name() : void
- Update term name.
- update_meta() : int|WP_Error|bool
- Update meta data.
Methods
__construct()
Clarkson_Term constructor.
public
__construct(WP_Term $term) : mixed
Parameters
- $term : WP_Term
Return values
mixed —__get()
Check if an existing field is requested.
public
__get(string $name) : mixed
Parameters
- $name : string
-
Field to search by.
Tags
Return values
mixed —add_meta()
Update meta data.
public
add_meta(string $key, mixed $value) : bool|int|WP_Error
Parameters
- $key : string
-
Meta key.
- $value : mixed
-
New meta data.
Return values
bool|int|WP_Error —delete_meta()
Delete meta data.
public
delete_meta(string $key[, null $value = null ]) : bool
Parameters
- $key : string
-
Meta key.
- $value : null = null
-
Meta value = null because to be deleted.
Return values
bool —get()
Alias of `get_by_id()`.
public
static get(int $term_id) : Clarkson_Term|null
Parameters
- $term_id : int
Return values
Clarkson_Term|null —get_by_id()
Get term by id.
public
static get_by_id(int $term_id[, null|string $taxonomy = null ]) : Clarkson_Term|null
Parameters
- $term_id : int
-
Term id.
- $taxonomy : null|string = null
-
Taxonomy.
Return values
Clarkson_Term|null —get_by_name()
Get term by name.
public
static get_by_name(string $name[, null|string $taxonomy = null ]) : Clarkson_Term|null
Parameters
- $name : string
-
Term name.
- $taxonomy : null|string = null
-
Taxonomy.
Return values
Clarkson_Term|null —get_by_slug()
Get term by slug.
public
static get_by_slug(string $slug[, null|string $taxonomy = null ]) : null|Clarkson_Term
Parameters
- $slug : string
-
Term slug.
- $taxonomy : null|string = null
-
Taxonomy.
Return values
null|Clarkson_Term —Term object.
get_description()
Get the term description.
public
get_description() : string
Return values
string —Term description.
get_id()
Get the id of the term.
public
get_id() : int
Return values
int —Term id.
get_many()
Get multiple terms as Clarkson Objects.
public
static get_many(array<string|int, mixed> $args[, mixed &$term_query = null ]) : array<string|int, Clarkson_Term>
Parameters
- $args : array<string|int, mixed>
-
- $term_query : mixed = null
-
The $term_query is passed by reference and will be filled with the WP_Term_Query that produced these results.
Tags
Return values
array<string|int, Clarkson_Term> —get_meta()
Get term meta data by id.
public
get_meta(string $key[, bool $single = false ]) : string|array<string|int, mixed>
Parameters
- $key : string
-
Meta key.
- $single : bool = false
-
Single or array.
Return values
string|array<string|int, mixed> —Meta data.
get_name()
Get the term name.
public
get_name() : string
Return values
string —Term name.
get_one()
Gets the first result from a `::get_many()` query.
public
static get_one([array<string|int, mixed> $args = array() ]) : Clarkson_Term|null
Parameters
Return values
Clarkson_Term|null —get_parent()
Get the term parent.
public
get_parent() : Clarkson_Term|null
Return values
Clarkson_Term|null —get_permalink()
Get the term permalink.
public
get_permalink() : string|WP_Error
Return values
string|WP_Error —Term permalink.
get_slug()
Get the term slug.
public
get_slug() : string
Return values
string —Term slug.
get_taxonomy()
Get the taxonomy.
public
get_taxonomy() : string
Return values
string —Taxonomy.
get_taxonomy_object()
Get the term's taxonomy object.
public
get_taxonomy_object() : Clarkson_Taxonomy|null
Return values
Clarkson_Taxonomy|null —get_term()
Get the term data.
public
get_term() : WP_Term
Return values
WP_Term —get_term_taxonomy_id()
Get the taxonomy id.
public
get_term_taxonomy_id() : int
Return values
int —Taxonomy id.
is_queried_object()
Check if this term was used in the global $wp_query.
public
is_queried_object() : bool
Return values
bool —set_name()
Update term name.
public
set_name(string $name) : void
Parameters
- $name : string
-
New term name.
Return values
void —update_meta()
Update meta data.
public
update_meta(string $key, mixed $value) : int|WP_Error|bool
Parameters
- $key : string
-
Meta key.
- $value : mixed
-
New meta data.