GET /sites/$site/post-types

Get a list of post types available for a site.

Resource Information

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

Method Parameters

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

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.
api_queryable (bool) If true, only queryable post types are returned

Response Parameters

Parameter Type Description
found (int) The number of post types found
post_types (array) A list of available post types

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

Example

curl 'https://public-api.wordpress.com/rest/v1.1/sites/33534099/post-types'
<?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',
	false,
	$context
);
$response = json_decode( $response );
?>

Response

{
    "found": 9,
    "post_types": [
        {
            "name": "post",
            "label": "Posts",
            "labels": {
                "name": "Posts",
                "singular_name": "Post",
                "add_new": "Add New",
                "add_new_item": "Add New Post",
                "edit_item": "Edit Post",
                "new_item": "New Post",
                "view_item": "View Post",
                "view_items": "View Posts",
                "search_items": "Search Posts",
                "not_found": "No posts found.",
                "not_found_in_trash": "No posts found in Trash.",
                "parent_item_colon": null,
                "all_items": "All Posts",
                "archives": "Post Archives",
                "attributes": "Post Attributes",
                "insert_into_item": "Insert into post",
                "uploaded_to_this_item": "Uploaded to this post",
                "featured_image": "Featured Image",
                "set_featured_image": "Set featured image",
                "remove_featured_image": "Remove featured image",
                "use_featured_image": "Use as featured image",
                "filter_items_list": "Filter posts list",
                "items_list_navigation": "Posts list navigation",
                "items_list": "Posts list",
                "item_published": "Post published.",
                "item_published_privately": "Post published privately.",
                "item_reverted_to_draft": "Post reverted to draft.",
                "item_scheduled": "Post scheduled.",
                "item_updated": "Post updated.",
                "menu_name": "Posts",
                "name_admin_bar": "Post"
            },
            "description": "",
            "map_meta_cap": true,
            "capabilities": {
                "edit_post": "edit_post",
                "read_post": "read_post",
                "delete_post": "delete_post",
                "edit_posts": "edit_posts",
                "edit_others_posts": "edit_others_posts",
                "publish_posts": "publish_posts",
                "read_private_posts": "read_private_posts",
                "read": "read",
                "delete_posts": "delete_posts",
                "delete_private_posts": "delete_private_posts",
                "delete_published_posts": "delete_published_posts",
                "delete_others_posts": "delete_others_posts",
                "edit_private_posts": "edit_private_posts",
                "edit_published_posts": "edit_published_posts",
                "create_posts": "edit_posts"
            },
            "hierarchical": false,
            "public": true,
            "show_ui": true,
            "publicly_queryable": true,
            "api_queryable": true,
            "supports": {
                "title": true,
                "editor": true,
                "author": true,
                "thumbnail": true,
                "excerpt": true,
                "trackbacks": true,
                "custom-fields": true,
                "comments": true,
                "revisions": true,
                "post-formats": true,
                "amp": true,
                "publicize": true,
                "geo-location": true,
                "wpcom-markdown": true,
                "jetpack-post-likes": true,
                "tags": true
            }
        },
        {
            "name": "page",
            "label": "Pages",
            "labels": {
                "name": "Pages",
                "singular_name": "Page",
                "add_new": "Add New",
                "add_new_item": "Add New Page",
                "edit_item": "Edit Page",
                "new_item": "New Page",
                "view_item": "View Page",
                "view_items": "View Pages",
                "search_items": "Search Pages",
                "not_found": "No pages found.",
                "not_found_in_trash": "No pages found in Trash.",
                "parent_item_colon": "Parent Page:",
                "all_items": "All Pages",
                "archives": "Page Archives",
                "attributes": "Page Attributes",
                "insert_into_item": "Insert into page",
                "uploaded_to_this_item": "Uploaded to this page",
                "featured_image": "Featured Image",
                "set_featured_image": "Set featured image",
                "remove_featured_image": "Remove featured image",
                "use_featured_image": "Use as featured image",
                "filter_items_list": "Filter pages list",
                "items_list_navigation": "Pages list navigation",
                "items_list": "Pages list",
                "item_published": "Page published.",
                "item_published_privately": "Page published privately.",
                "item_reverted_to_draft": "Page reverted to draft.",
                "item_scheduled": "Page scheduled.",
                "item_updated": "Page updated.",
                "menu_name": "Pages",
                "name_admin_bar": "Page"
            },
            "description": "",
            "map_meta_cap": true,
            "capabilities": {
                "edit_post": "edit_page",
                "read_post": "read_page",
                "delete_post": "delete_page",
                "edit_posts": "edit_pages",
                "edit_others_posts": "edit_others_pages",
                "publish_posts": "publish_pages",
                "read_private_posts": "read_private_pages",
                "read": "read",
                "delete_posts": "delete_pages",
                "delete_private_posts": "delete_private_pages",
                "delete_published_posts": "delete_published_pages",
                "delete_others_posts": "delete_others_pages",
                "edit_private_posts": "edit_private_pages",
                "edit_published_posts": "edit_published_pages",
                "create_posts": "edit_pages"
            },
            "hierarchical": true,
            "public": true,
            "show_ui": true,
            "publicly_queryable": false,
            "api_queryable": true,
            "supports": {
                "title": true,
                "editor": true,
                "author": true,
                "thumbnail": true,
                "page-attributes": true,
                "custom-fields": true,
                "comments": true,
                "revisions": true,
                "geo-location": true,
                "excerpt": true,
                "wpcom-markdown": true,
                "jetpack-post-likes": true
            }
        },
        {
            "name": "attachment",
            "label": "Media",
            "labels": {
                "name": "Media",
                "singular_name": "Media",
                "add_new": "Add New",
                "add_new_item": "Add New Post",
                "edit_item": "Edit Media",
                "new_item": "New Post",
                "view_item": "View Attachment Page",
                "view_items": "View Posts",
                "search_items": "Search Posts",
                "not_found": "No posts found.",
                "not_found_in_trash": "No posts found in Trash.",
                "parent_item_colon": null,
                "all_items": "Media",
                "archives": "Media",
                "attributes": "Attachment Attributes",
                "insert_into_item": "Insert into post",
                "uploaded_to_this_item": "Uploaded to this post",
                "featured_image": "Featured Image",
                "set_featured_image": "Set featured image",
                "remove_featured_image": "Remove featured image",
                "use_featured_image": "Use as featured image",
                "filter_items_list": "Filter posts list",
                "items_list_navigation": "Posts list navigation",
                "items_list": "Posts list",
                "item_published": "Post published.",
                "item_published_privately": "Post published privately.",
                "item_reverted_to_draft": "Post reverted to draft.",
                "item_scheduled": "Post scheduled.",
                "item_updated": "Post updated.",
                "menu_name": "Media",
                "name_admin_bar": "Media"
            },
            "description": "",
            "map_meta_cap": true,
            "capabilities": {
                "edit_post": "edit_post",
                "read_post": "read_post",
                "delete_post": "delete_post",
                "edit_posts": "edit_posts",
                "edit_others_posts": "edit_others_posts",
                "publish_posts": "publish_posts",
                "read_private_posts": "read_private_posts",
                "read": "read",
                "delete_posts": "delete_posts",
                "delete_private_posts": "delete_private_posts",
                "delete_published_posts": "delete_published_posts",
                "delete_others_posts": "delete_others_posts",
                "edit_private_posts": "edit_private_posts",
                "edit_published_posts": "edit_published_posts",
                "create_posts": "upload_files"
            },
            "hierarchical": false,
            "public": true,
            "show_ui": true,
            "publicly_queryable": true,
            "api_queryable": true,
            "supports": {
                "title": true,
                "author": true,
                "comments": true,
                "jetpack-post-likes": true
            }
        },
        {
            "name": "revision",
            "label": "Revisions",
            "labels": {
                "name": "Revisions",
                "singular_name": "Revision",
                "add_new": "Add New",
                "add_new_item": "Add New Post",
                "edit_item": "Edit Post",
                "new_item": "New Post",
                "view_item": "View Post",
                "view_items": "View Posts",
                "search_items": "Search Posts",
                "not_found": "No posts found.",
                "not_found_in_trash": "No posts found in Trash.",
                "parent_item_colon": null,
                "all_items": "Revisions",
                "archives": "Revisions",
                "attributes": "Post Attributes",
                "insert_into_item": "Insert into post",
                "uploaded_to_this_item": "Uploaded to this post",
                "featured_image": "Featured Image",
                "set_featured_image": "Set featured image",
                "remove_featured_image": "Remove featured image",
                "use_featured_image": "Use as featured image",
                "filter_items_list": "Filter posts list",
                "items_list_navigation": "Posts list navigation",
                "items_list": "Posts list",
                "item_published": "Post published.",
                "item_published_privately": "Post published privately.",
                "item_reverted_to_draft": "Post reverted to draft.",
                "item_scheduled": "Post scheduled.",
                "item_updated": "Post updated.",
                "menu_name": "Revisions",
                "name_admin_bar": "Revision"
            },
            "description": "",
            "map_meta_cap": true,
            "capabilities": {
                "edit_post": "edit_post",
                "read_post": "read_post",
                "delete_post": "delete_post",
                "edit_posts": "edit_posts",
                "edit_others_posts": "edit_others_posts",
                "publish_posts": "publish_posts",
                "read_private_posts": "read_private_posts",
                "read": "read",
                "delete_posts": "delete_posts",
                "delete_private_posts": "delete_private_posts",
                "delete_published_posts": "delete_published_posts",
                "delete_others_posts": "delete_others_posts",
                "edit_private_posts": "edit_private_posts",
                "edit_published_posts": "edit_published_posts",
                "create_posts": "edit_posts"
            },
            "hierarchical": false,
            "public": false,
            "show_ui": false,
            "publicly_queryable": false,
            "api_queryable": true,
            "supports": {
                "author": true,
                "wpcom-markdown": true
            }
        },
        {
            "name": "wp_block",
            "label": "Blocks",
            "labels": {
                "name": "Blocks",
                "singular_name": "Block",
                "add_new": "Add New",
                "add_new_item": "Add New Block",
                "edit_item": "Edit Block",
                "new_item": "New Block",
                "view_item": "View Block",
                "view_items": "View Posts",
                "search_items": "Search Blocks",
                "not_found": "No blocks found.",
                "not_found_in_trash": "No blocks found in Trash.",
                "parent_item_colon": null,
                "all_items": "All Blocks",
                "archives": "All Blocks",
                "attributes": "Post Attributes",
                "insert_into_item": "Insert into post",
                "uploaded_to_this_item": "Uploaded to this post",
                "featured_image": "Featured Image",
                "set_featured_image": "Set featured image",
                "remove_featured_image": "Remove featured image",
                "use_featured_image": "Use as featured image",
                "filter_items_list": "Filter blocks list",
                "items_list_navigation": "Blocks list navigation",
                "items_list": "Blocks list",
                "item_published": "Block published.",
                "item_published_privately": "Block published privately.",
                "item_reverted_to_draft": "Block reverted to draft.",
                "item_scheduled": "Block scheduled.",
                "item_updated": "Block updated.",
                "menu_name": "Blocks",
                "name_admin_bar": "Block"
            },
            "description": "",
            "map_meta_cap": true,
            "capabilities": {
                "edit_post": "edit_block",
                "read_post": "read_block",
                "delete_post": "delete_block",
                "edit_posts": "edit_posts",
                "edit_others_posts": "edit_others_posts",
                "publish_posts": "publish_blocks",
                "read_private_posts": "read_private_blocks",
                "read": "edit_posts",
                "delete_posts": "delete_blocks",
                "delete_private_posts": "delete_private_blocks",
                "delete_published_posts": "delete_published_posts",
                "delete_others_posts": "delete_others_posts",
                "edit_private_posts": "edit_private_blocks",
                "edit_published_posts": "edit_published_posts",
                "create_posts": "publish_posts"
            },
            "hierarchical": false,
            "public": false,
            "show_ui": true,
            "publicly_queryable": false,
            "api_queryable": true,
            "supports": {
                "title": true,
                "editor": true
            }
        },
        {
            "name": "feedback",
            "label": "Feedback",
            "labels": {
                "name": "Feedback",
                "singular_name": "Feedback",
                "add_new": "Add New",
                "add_new_item": "Add New Post",
                "edit_item": "Edit Post",
                "new_item": "New Post",
                "view_item": "View Post",
                "view_items": "View Posts",
                "search_items": "Search Feedback",
                "not_found": "No feedback found",
                "not_found_in_trash": "No feedback found",
                "parent_item_colon": null,
                "all_items": "Feedback",
                "archives": "Feedback",
                "attributes": "Post Attributes",
                "insert_into_item": "Insert into post",
                "uploaded_to_this_item": "Uploaded to this post",
                "featured_image": "Featured Image",
                "set_featured_image": "Set featured image",
                "remove_featured_image": "Remove featured image",
                "use_featured_image": "Use as featured image",
                "filter_items_list": "Filter posts list",
                "items_list_navigation": "Posts list navigation",
                "items_list": "Posts list",
                "item_published": "Post published.",
                "item_published_privately": "Post published privately.",
                "item_reverted_to_draft": "Post reverted to draft.",
                "item_scheduled": "Post scheduled.",
                "item_updated": "Post updated.",
                "menu_name": "Feedback",
                "name_admin_bar": "Feedback"
            },
            "description": "",
            "map_meta_cap": true,
            "capabilities": {
                "edit_post": "edit_page",
                "read_post": "read_page",
                "delete_post": "delete_page",
                "edit_posts": "edit_pages",
                "edit_others_posts": "edit_others_pages",
                "publish_posts": "publish_pages",
                "read_private_posts": "read_private_pages",
                "read": "read",
                "delete_posts": "delete_pages",
                "delete_private_posts": "delete_private_pages",
                "delete_published_posts": "delete_published_pages",
                "delete_others_posts": "delete_others_pages",
                "edit_private_posts": "edit_private_pages",
                "edit_published_posts": "edit_published_pages",
                "create_posts": false
            },
            "hierarchical": false,
            "public": false,
            "show_ui": true,
            "publicly_queryable": false,
            "api_queryable": true,
            "supports": {
                "title": true,
                "editor": true
            }
        },
        {
            "name": "jp_mem_plan",
            "label": "Plan",
            "labels": {
                "name": "Plan",
                "singular_name": "Plan",
                "add_new": "Add New",
                "add_new_item": "Add New Post",
                "edit_item": "Edit Post",
                "new_item": "New Post",
                "view_item": "View Post",
                "view_items": "View Posts",
                "search_items": "Search Posts",
                "not_found": "No posts found.",
                "not_found_in_trash": "No posts found in Trash.",
                "parent_item_colon": null,
                "all_items": "Plan",
                "archives": "Plan",
                "attributes": "Post Attributes",
                "insert_into_item": "Insert into post",
                "uploaded_to_this_item": "Uploaded to this post",
                "featured_image": "Featured Image",
                "set_featured_image": "Set featured image",
                "remove_featured_image": "Remove featured image",
                "use_featured_image": "Use as featured image",
                "filter_items_list": "Filter posts list",
                "items_list_navigation": "Posts list navigation",
                "items_list": "Posts list",
                "item_published": "Post published.",
                "item_published_privately": "Post published privately.",
                "item_reverted_to_draft": "Post reverted to draft.",
                "item_scheduled": "Post scheduled.",
                "item_updated": "Post updated.",
                "menu_name": "Plan",
                "name_admin_bar": "Plan"
            },
            "description": "Recurring Payments plans",
            "map_meta_cap": false,
            "capabilities": {
                "edit_post": "edit_posts",
                "read_post": "read_private_posts",
                "delete_post": "delete_posts",
                "edit_posts": "edit_posts",
                "edit_others_posts": "edit_others_posts",
                "publish_posts": "publish_posts",
                "read_private_posts": "read_private_posts",
                "create_posts": "edit_posts"
            },
            "hierarchical": false,
            "public": false,
            "show_ui": false,
            "publicly_queryable": false,
            "api_queryable": true,
            "supports": {
                "title": true,
                "custom-fields": true,
                "content": true
            }
        },
        {
            "name": "jp_pay_order",
            "label": "Order",
            "labels": {
                "name": "Order",
                "singular_name": "Order",
                "add_new": "Add New",
                "add_new_item": "Add New Post",
                "edit_item": "Edit Post",
                "new_item": "New Post",
                "view_item": "View Post",
                "view_items": "View Posts",
                "search_items": "Search Posts",
                "not_found": "No posts found.",
                "not_found_in_trash": "No posts found in Trash.",
                "parent_item_colon": null,
                "all_items": "Order",
                "archives": "Order",
                "attributes": "Post Attributes",
                "insert_into_item": "Insert into post",
                "uploaded_to_this_item": "Uploaded to this post",
                "featured_image": "Featured Image",
                "set_featured_image": "Set featured image",
                "remove_featured_image": "Remove featured image",
                "use_featured_image": "Use as featured image",
                "filter_items_list": "Filter posts list",
                "items_list_navigation": "Posts list navigation",
                "items_list": "Posts list",
                "item_published": "Post published.",
                "item_published_privately": "Post published privately.",
                "item_reverted_to_draft": "Post reverted to draft.",
                "item_scheduled": "Post scheduled.",
                "item_updated": "Post updated.",
                "menu_name": "Order",
                "name_admin_bar": "Order"
            },
            "description": "Simple Payments orders",
            "map_meta_cap": false,
            "capabilities": {
                "edit_post": "edit_posts",
                "read_post": "read_private_posts",
                "delete_post": "delete_posts",
                "edit_posts": "edit_posts",
                "edit_others_posts": "edit_others_posts",
                "publish_posts": "publish_posts",
                "read_private_posts": "read_private_posts",
                "create_posts": "edit_posts"
            },
            "hierarchical": false,
            "public": false,
            "show_ui": false,
            "publicly_queryable": false,
            "api_queryable": true,
            "supports": {
                "custom-fields": true,
                "excerpt": true
            }
        },
        {
            "name": "jp_pay_product",
            "label": "Product",
            "labels": {
                "name": "Product",
                "singular_name": "Product",
                "add_new": "Add New",
                "add_new_item": "Add New Post",
                "edit_item": "Edit Post",
                "new_item": "New Post",
                "view_item": "View Post",
                "view_items": "View Posts",
                "search_items": "Search Posts",
                "not_found": "No posts found.",
                "not_found_in_trash": "No posts found in Trash.",
                "parent_item_colon": null,
                "all_items": "Product",
                "archives": "Product",
                "attributes": "Post Attributes",
                "insert_into_item": "Insert into post",
                "uploaded_to_this_item": "Uploaded to this post",
                "featured_image": "Featured Image",
                "set_featured_image": "Set featured image",
                "remove_featured_image": "Remove featured image",
                "use_featured_image": "Use as featured image",
                "filter_items_list": "Filter posts list",
                "items_list_navigation": "Posts list navigation",
                "items_list": "Posts list",
                "item_published": "Post published.",
                "item_published_privately": "Post published privately.",
                "item_reverted_to_draft": "Post reverted to draft.",
                "item_scheduled": "Post scheduled.",
                "item_updated": "Post updated.",
                "menu_name": "Product",
                "name_admin_bar": "Product"
            },
            "description": "Simple Payments products",
            "map_meta_cap": false,
            "capabilities": {
                "edit_post": "edit_posts",
                "read_post": "read_private_posts",
                "delete_post": "delete_posts",
                "edit_posts": "publish_posts",
                "edit_others_posts": "edit_others_posts",
                "publish_posts": "publish_posts",
                "read_private_posts": "read_private_posts",
                "create_posts": "publish_posts"
            },
            "hierarchical": false,
            "public": false,
            "show_ui": false,
            "publicly_queryable": false,
            "api_queryable": true,
            "supports": {
                "title": true,
                "editor": true,
                "thumbnail": true,
                "custom-fields": true,
                "author": true
            }
        }
    ]
}