| | 59 | * Get a list of all registered taxonomy objects. |
| | 60 | * |
| | 61 | * @package WordPress |
| | 62 | * @subpackage Taxonomy |
| | 63 | * @since 2.9.0 |
| | 64 | * @uses $wp_taxonomies |
| | 65 | * @see register_taxonomy |
| | 66 | * |
| | 67 | * @param array|string $args An array of key => value arguments to match against the taxonomies. |
| | 68 | * Only taxonomies having attributes that match all arguments are returned. |
| | 69 | * @param string $output The type of output to return, either taxonomy 'names' or 'objects'. 'names' is the default. |
| | 70 | * @return array A list of taxonomy names or objects |
| | 71 | */ |
| | 72 | function get_taxonomies( $args = array(), $output = 'names' ) { |
| | 73 | global $wp_taxonomies; |
| | 74 | |
| | 75 | $do_names = false; |
| | 76 | if ( 'names' == $output ) |
| | 77 | $do_names = true; |
| | 78 | |
| | 79 | $taxonomies = array(); |
| | 80 | foreach ( (array) $wp_taxonomies as $taxonomy ) { |
| | 81 | if ( empty($args) ) { |
| | 82 | if ( $do_names ) |
| | 83 | $taxonomies[] = $taxonomy->name; |
| | 84 | else |
| | 85 | $taxonomies[] = $taxonomy; |
| | 86 | } elseif ( array_intersect_assoc((array) $taxonomy, $args) ) { |
| | 87 | if ( $do_names ) |
| | 88 | $taxonomies[] = $taxonomy->name; |
| | 89 | else |
| | 90 | $taxonomies[] = $taxonomy; |
| | 91 | } |
| | 92 | } |
| | 93 | |
| | 94 | return $taxonomies; |
| | 95 | } |
| | 96 | |
| | 97 | /** |