Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




is_object_in_taxonomy [ WordPress Function ]

is_object_in_taxonomy ( $object_type, $taxonomy )
Parameters:
  • (string) $object_type Object type string
  • (string) $taxonomy Single taxonomy name
Uses:
Returns:
  • (bool) True if object is associated with the taxonomy, otherwise false.
Defined at:



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

Source


<?php
function is_object_in_taxonomy($object_type$taxonomy) {
    
$taxonomies get_object_taxonomies($object_type);

    if ( empty(
$taxonomies) )
        return 
false;

    if ( 
in_array($taxonomy$taxonomies) )
        return 
true;

    return 
false;
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics