GET /sites/$site/post-types/$post_type/taxonomies

Get a list of taxonomies associated with a post type.

Resource Information

   
Method GET
URL https://public-api.wordpress.com/rest/v1.1/sites/$site/post-types/$post_type/taxonomies
Requires authentication? No

Method Parameters

Parameter Type Description
$site (int|string) Site ID or domain
$post_type (string) Post type

Query Parameters

Parameter Type Description
context (string)
display:
(default) Formats the output as HTML for display. Shortcodes are parsed, paragraph tags are added, etc..
edit:
Formats the output for editing. Shortcodes are left unparsed, significant whitespace is kept, etc..
http_envelope (bool)
false:
(default)
true:
Some environments (like in-browser JavaScript or Flash) block or divert responses with a non-200 HTTP status code. Setting this parameter will force the HTTP status code to always be 200. The JSON response is wrapped in an "envelope" containing the "real" HTTP status code and headers.
pretty (bool)
false:
(default)
true:
Output pretty JSON
meta (string) Optional. Loads data from the endpoints found in the 'meta' part of the response. Comma-separated list. Example: meta=site,likes
fields (string) Optional. Returns specified fields only. Comma-separated list. Example: fields=ID,title
callback (string) An optional JSONP callback function.

Response Parameters

Parameter Type Description
found (int) The number of taxonomies found
taxonomies (array) A list of available taxonomies

Resource Errors

These are the possible errors returned by this endpoint.

HTTP Code Error Identifier Error Message
403 unauthorized User cannot access this private blog.
403 unauthorized User cannot access this restricted blog
404 unknown_post_type Unknown post type

Example

curl 'https://public-api.wordpress.com/rest/v1.1/sites/33534099/post-types/post/taxonomies'
<?php
$options  = array (
  'http' => 
  array (
    'ignore_errors' => true,
  ),
);

$context  = stream_context_create( $options );
$response = file_get_contents(
	'https://public-api.wordpress.com/rest/v1.1/sites/33534099/post-types/post/taxonomies',
	false,
	$context
);
$response = json_decode( $response );
?>

Response

{
    "found": 4,
    "taxonomies": [
        {
            "name": "category",
            "label": "Categories",
            "labels": {
                "name": "Categories",
                "singular_name": "Category",
                "search_items": "Search Categories",
                "popular_items": null,
                "all_items": "All Categories",
                "parent_item": "Parent Category",
                "parent_item_colon": "Parent Category:",
                "edit_item": "Edit Category",
                "view_item": "View Category",
                "update_item": "Update Category",
                "add_new_item": "Add New Category",
                "new_item_name": "New Category Name",
                "separate_items_with_commas": null,
                "add_or_remove_items": null,
                "choose_from_most_used": null,
                "not_found": "No categories found.",
                "no_terms": "No categories",
                "items_list_navigation": "Categories list navigation",
                "items_list": "Categories list",
                "most_used": "Most Used",
                "back_to_items": "← Back to Categories",
                "menu_name": "Categories",
                "name_admin_bar": "category"
            },
            "description": "",
            "hierarchical": true,
            "public": true,
            "capabilities": {
                "manage_terms": "manage_categories",
                "edit_terms": "edit_categories",
                "delete_terms": "delete_categories",
                "assign_terms": "assign_categories"
            }
        },
        {
            "name": "post_tag",
            "label": "Tags",
            "labels": {
                "name": "Tags",
                "singular_name": "Tag",
                "search_items": "Search Tags",
                "popular_items": "Popular Tags",
                "all_items": "All Tags",
                "parent_item": null,
                "parent_item_colon": null,
                "edit_item": "Edit Tag",
                "view_item": "View Tag",
                "update_item": "Update Tag",
                "add_new_item": "Add New Tag",
                "new_item_name": "New Tag Name",
                "separate_items_with_commas": "Separate tags with commas",
                "add_or_remove_items": "Add or remove tags",
                "choose_from_most_used": "Choose from the most used tags",
                "not_found": "No tags found.",
                "no_terms": "No tags",
                "items_list_navigation": "Tags list navigation",
                "items_list": "Tags list",
                "most_used": "Most Used",
                "back_to_items": "← Back to Tags",
                "menu_name": "Tags",
                "name_admin_bar": "post_tag"
            },
            "description": "",
            "hierarchical": false,
            "public": true,
            "capabilities": {
                "manage_terms": "manage_post_tags",
                "edit_terms": "edit_post_tags",
                "delete_terms": "delete_post_tags",
                "assign_terms": "assign_post_tags"
            }
        },
        {
            "name": "post_format",
            "label": "Format",
            "labels": {
                "name": "Format",
                "singular_name": "Format",
                "search_items": "Search Tags",
                "popular_items": "Popular Tags",
                "all_items": "Format",
                "parent_item": null,
                "parent_item_colon": null,
                "edit_item": "Edit Tag",
                "view_item": "View Tag",
                "update_item": "Update Tag",
                "add_new_item": "Add New Tag",
                "new_item_name": "New Tag Name",
                "separate_items_with_commas": "Separate tags with commas",
                "add_or_remove_items": "Add or remove tags",
                "choose_from_most_used": "Choose from the most used tags",
                "not_found": "No tags found.",
                "no_terms": "No tags",
                "items_list_navigation": "Tags list navigation",
                "items_list": "Tags list",
                "most_used": "Most Used",
                "back_to_items": "← Back to Tags",
                "menu_name": "Format",
                "name_admin_bar": "Format",
                "archives": "Format"
            },
            "description": "",
            "hierarchical": false,
            "public": true,
            "capabilities": {
                "manage_terms": "manage_categories",
                "edit_terms": "manage_categories",
                "delete_terms": "manage_categories",
                "assign_terms": "edit_posts"
            }
        },
        {
            "name": "mentions",
            "label": "Mentions",
            "labels": {
                "name": "Mentions",
                "singular_name": "Mentions",
                "search_items": "Search Tags",
                "popular_items": "Popular Tags",
                "all_items": "Mentions",
                "parent_item": null,
                "parent_item_colon": null,
                "edit_item": "Edit Tag",
                "view_item": "View Tag",
                "update_item": "Update Tag",
                "add_new_item": "Add New Tag",
                "new_item_name": "New Tag Name",
                "separate_items_with_commas": "Separate tags with commas",
                "add_or_remove_items": "Add or remove tags",
                "choose_from_most_used": "Choose from the most used tags",
                "not_found": "No tags found.",
                "no_terms": "No tags",
                "items_list_navigation": "Tags list navigation",
                "items_list": "Tags list",
                "most_used": "Most Used",
                "back_to_items": "← Back to Tags",
                "menu_name": "Mentions",
                "name_admin_bar": "Mentions",
                "archives": "Mentions"
            },
            "description": "",
            "hierarchical": false,
            "public": true,
            "capabilities": {
                "manage_terms": "manage_categories",
                "edit_terms": "manage_categories",
                "delete_terms": "manage_categories",
                "assign_terms": "edit_posts"
            }
        }
    ]
}