WP_Taxonomy::__construct() WordPress Method

This method is used to create a new WP_Taxonomy object. It takes two parameters: $taxonomy - The taxonomy name. $object_type - An array of object types this taxonomy applies to.

WP_Taxonomy::__construct( string $taxonomy, array|string $object_type, array|string $args = array() ) #

Constructor.


Description

See the register_taxonomy() function for accepted arguments for $args.


Top ↑

Parameters

$taxonomy

(string)(Required)Taxonomy key, must not exceed 32 characters.

$object_type

(array|string)(Required)Name of the object type for the taxonomy object.

$args

(array|string)(Optional) Array or query string of arguments for registering a taxonomy.

Default value: array()


Top ↑

Source

File: wp-includes/class-wp-taxonomy.php

	public function __construct( $taxonomy, $object_type, $args = array() ) {
		$this->name = $taxonomy;

		$this->set_props( $object_type, $args );
	}


Top ↑

Changelog

Changelog
VersionDescription
4.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.