Taxonomy
in package
Taxonomy Module class.
Tags
Table of Contents
Properties
- $action_hook : ActionHook
- ActionHook instance.
- $args : array<string|int, mixed>|null
- Array of arguments to automatically use inside `wp_get_object_terms()` for this taxonomy.
- $object_type : array<string|int, string>
- An array of object types this taxonomy is registered for.
- $taxonomy : string
- Taxonomy key.
Methods
- __construct() : mixed
- Constructor.
- __toString() : string
- Custom toString magic method.
- register_taxonomy() : void
- Registers the taxonomy with WordPress.
- initialize() : void
- Initializes the taxonomy.
Properties
$action_hook
ActionHook instance.
private
ActionHook
$action_hook
ActionHook object for the register_taxonomy method.
Tags
$args
Array of arguments to automatically use inside `wp_get_object_terms()` for this taxonomy.
private
array<string|int, mixed>|null
$args
Array or query string of arguments for registering a taxonomy.
Tags
$object_type
An array of object types this taxonomy is registered for.
private
array<string|int, string>
$object_type
Object type or array of object types with which the taxonomy should be associated.
Tags
$taxonomy
Taxonomy key.
private
string
$taxonomy
Taxonomy key. Must not exceed 32 characters and may only contain lowercase alphanumeric characters, dashes, and underscores. See sanitize_key() .
Tags
Methods
__construct()
Constructor.
public
__construct(string $taxonomy, array<string|int, mixed>|string $object_type, array<string|int, mixed>|string $args[, ActionHook $action_hook = null ]) : mixed
Constructs the Taxonomy object by setting the taxonomy, object type, and arguments.
Parameters
- $taxonomy : string
-
Taxonomy key, must not exceed 32 characters.
- $object_type : array<string|int, mixed>|string
-
Name of the object type for the taxonomy object.
- $args : array<string|int, mixed>|string
-
Optional. Array or query string of arguments for registering a taxonomy. See register_taxonomy() for information on accepted arguments.
- $action_hook : ActionHook = null
-
Optional. ActionHook object for the register_taxonomy method.
Tags
__toString()
Custom toString magic method.
public
__toString() : string
Returns the taxonomy as a JSON string.
Tags
Return values
string —JSON string.
register_taxonomy()
Registers the taxonomy with WordPress.
public
register_taxonomy() : void
Uses the register_taxonomy()
function to register the taxonomy.
Tags
initialize()
Initializes the taxonomy.
private
initialize() : void
Hooks the action to register the taxonomy and adds the taxonomy to the registry.