Uma área de pesquisa sobre o WordPress para devs e autores do tema



is_object_in_taxonomy ›

Desde3.0.0
Obsoleton/a
is_object_in_taxonomy ( $object_type, $taxonomy )
Parâmetros: (2)
  • (string) $object_type Object type string.
    Required: Yes
  • (string) $taxonomy Single taxonomy name.
    Required: Yes
Retorna:
  • (bool) True if object is associated with the taxonomy, otherwise false.
Definido em:
Codex:

Determine if the given object type is associated with the given taxonomy.



Fonte

function is_object_in_taxonomy( $object_type, $taxonomy ) {
	$taxonomies = get_object_taxonomies( $object_type );
	if ( empty( $taxonomies ) ) {
		return false;
	}
	return in_array( $taxonomy, $taxonomies );
}