Documentation

Taxonomy
in package

Taxonomy Module class.

Tags
since
1.0.0

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
since
1.0.0

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
since
1.0.0

__toString()

Custom toString magic method.

public __toString() : string

Returns the taxonomy as a JSON string.

Tags
since
1.0.0
Return values
string

JSON string.

initialize()

Initializes the taxonomy.

private initialize() : void

Hooks the action to register the taxonomy and adds the taxonomy to the registry.

Tags
since
1.0.0

        
On this page

Search results