The What
Syntax
get_taxonomies( array $args = array(), string $output = 'names', string $operator = 'and' );
Description
This construct (function) gets all the registered taxonomies and returns them as an array of names or objects. The taxonomies are stored in the global variable $wp_taxonomies
. You specify whether you want to receive the list back with the names or the post type objects.
Keep in mind that when you call this function, it is fetching all the current registered taxonomies.
Parameters
args
- Array of arguments to specify what you want to receive back from the request. The array will be an associative array with key => value pairs. Some of the arguments include:
name
object_type
– arraylabel
show_ui
– booleanshow_tagcloud
– booleanpublic
update_count_callback
rewrite
query_var
manage_cap
edit_cap
delete_cap
assign_cap
_builtin
– boolean. Set totrue
to include the built-in taxonomies; else, only the taxonomies are returned.
Refer to the list of arguments available when registering the taxonomy.
output
- (Optional) Specify if you want the taxonomy objects, i.e.
objects
, returned to you. The default isnames
, meaning you will receive an array of taxonomy names. operator
- (Optional) The operator specifies whether the arguments are all of them (
and
) or any of them (or
). The default isand
.
Return Values
Returns an array (list) of taxonomy names or objects.
Hands off the keyboard. Web development starts by thinking first, then planning it out, and then coding it.
More coming soon…keep checking back.