bricks_get_post_types

Phase 1BeginnerRead OnlyComplexity: 2/10
List all registered post types and their taxonomies

Overview

Lists all registered WordPress post types including built-in types (posts, pages, attachments) and any custom post types (CPTs). Returns the slug, label, description, archive status, and REST API base for each type.

This tool is essential during Phase 1 to discover what content types exist on the site, and after registering new CPTs with bricks_register_post_type to verify they are active.

Key Features

Complete Post Type Inventory
Returns all registered post types with slug, label, description, and whether they have an archive page.
REST API Base Discovery
Shows the REST API base slug for each post type, essential for external API integrations and wp_list_posts calls.
Built-in and Custom Types
Includes both WordPress built-in types (post, page, attachment) and any registered custom post types.

When to Use

During Phase 1 to discover all available content types on the site
After registering a new CPT to verify it is active and has the correct settings
Before setting up query loops to confirm the correct post_type slug
When planning dynamic content templates for custom post types
To check REST API bases needed for external integrations
Prerequisites
No prerequisites — read-only tool that works on any site

When NOT to Use

When you only need page-specific information — use bricks_list_pages instead
When you need taxonomy information specifically — the site context includes taxonomies too

Parameters

1 Total Parameters1 Optional
(none)noneoptional
This tool takes no input parameters. It returns all registered post types with their taxonomies and field groups.

Code Examples


Warning: Undefined array key "example_output" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 12

Discover Available Post Types

Lists all registered post types. Use the returned slugs in query loops, bricks_create_post, and template conditions.

JSON
bricks_get_post_types()

Common Mistakes


Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 2018

Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48

Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Some post types have a different REST base than their slug. For example, the "page" post type uses "pages" as its REST base. Use the slug for Bricks tools and the REST base for wp_list_posts.

Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 2018

Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48

Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Always verify a CPT is registered before setting up query loops or creating posts. If bricks_register_post_type was just called, the type should appear in this listing.

Tips & Warnings

Tips & Warnings

REST base matters: When using wp_list_posts, you need the REST base (usually the slug), not the post type name. Check the rest_base field in the response.

Archive pages: Post types with has_archive=true automatically get an archive page at /slug/. Types without it require manual archive template creation.

Return Values

FieldTypeDescription
post_typesarrayArray of post type objects with slug, label, description, has_archive, and rest_base
slugstringPost type identifier (e.g., "post", "page", "portfolio")
labelstringHuman-readable plural label
has_archivebooleanWhether the post type has an archive page
rest_basestringREST API base slug for the post type

Related Tools

Technical Details

Tool ID
bricks_get_post_types
API Endpoint
/post-types
HTTP Method
GET
Namespace
wordpress-site
Source File
wordpress/post-types.ts
Version
1.0
Min Bricks Version
1.9
Requires Auth
Yes

Changelog

v1.0
Initial release
20250101