register_taxonomy_for_object_type

Advertisement

Summery Summery

Add an already registered taxonomy to an object type.

Syntax Syntax

register_taxonomy_for_object_type( string $taxonomy, string $object_type )

Parameters Parameters

$taxonomy

(Required) Name of taxonomy object.

$object_type

(Required) Name of the object type.

Return Return

(bool) True if successful, false if not.

Source Source

File: wp-includes/taxonomy.php

	$taxonomy = $tax->name;

	$default_labels = clone $labels;

	/**
	 * Filters the labels of a specific taxonomy.
	 *
	 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
	 *
	 * @since 4.4.0
	 *
	 * @see get_taxonomy_labels() for the full list of taxonomy labels.
	 *
	 * @param object $labels Object with labels for the taxonomy as member variables.
	 */
	$labels = apply_filters( "taxonomy_labels_{$taxonomy}", $labels );

	// Ensure that the filtered labels contain all required default values.
	$labels = (object) array_merge( (array) $default_labels, (array) $labels );

	return $labels;
}

/**
 * Add an already registered taxonomy to an object type.
 *
 * @since 3.0.0
 *
 * @global array $wp_taxonomies The registered taxonomies.

Advertisement

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.

Advertisement

Leave a Reply