get_taxonomies

Home » Functions » get_taxonomies

Function Name: get_taxonomies

The get_taxonomies function is a WordPress core function that retrieves an array of registered taxonomy objects. Taxonomies are used in WordPress to organize content by grouping it into categories, tags, or custom taxonomies. This function can be used to retrieve all the available taxonomies in WordPress for further processing.

The function has only one parameter, which is optional. This parameter is used to specify the type of taxonomy to retrieve. By default, the function retrieves all registered taxonomies. If the parameter is set to "objects", the function will return an array of taxonomy objects. If the parameter is set to "names", the function will return an array of taxonomy names.

Here is an example usage code that retrieves all registered taxonomies as objects:

$taxonomies = get_taxonomies('objects');
foreach ($taxonomies as $taxonomy) {
    echo $taxonomy->name;
}

This code retrieves all the registered taxonomies as objects, and then loops through each taxonomy object to print its name.

In conclusion, the get_taxonomies function is a useful WordPress core function that can be used to retrieve information about the registered taxonomies on your WordPress site.

Learn More on WordPress.org

WordPress snippets using the get_taxonomies function

Register an account to save your snippets or go Pro to get more features.