Home / Blog / WordPress Custom Post Types: How to Create One (2026)
Guides 10 min read

WordPress Custom Post Types: How to Create One (2026)

Table of Contents

WordPress ships with a handful of built-in content types: posts, pages, attachments. For most sites, those cover the basics. But when you need a portfolio of projects, a directory of team members, a catalog of recipes, or a library of case studies — you need a WordPress custom post type.

Custom post types (CPTs) let you define any kind of content, with its own admin menu, its own URL structure, its own fields, and its own taxonomy. They are one of the most powerful features WordPress has offered since version 2.9, and they underpin thousands of complex, structured-content websites.

This guide covers everything you need: what CPTs are, the five built-in post types, how to register your own with code or the CPT UI plugin, how to combine them with Advanced Custom Fields and custom taxonomies, the show_in_rest flag that matters for the block editor, and how Easy MCP AI lets Claude manage your CPT content through natural language.


What Is a WordPress Custom Post Type?

A custom post type is any content type in WordPress beyond the five built-in types. WordPress stores all content — posts, pages, and everything else — in the wp_posts database table, with a post_type column distinguishing them. When you register a new post type, you’re telling WordPress to treat a new value of post_type as a distinct content object with its own admin screens, labels, capabilities, REST API endpoints, and rewrite rules.

A portfolio CPT called project is structurally identical to a blog post inside the database. The difference is entirely in how WordPress registers and exposes it.


WordPress Default Post Types

WordPress ships with five built-in (“native”) post types. Understanding them is the foundation for understanding custom ones.

Post TypeSlugPurpose
PostpostBlog entries; supports categories and tags by default
PagepageHierarchical static content; no taxonomy support by default
AttachmentattachmentMedia library items (images, files, etc.)
RevisionrevisionAuto-saved historical versions of posts and pages
Navigation Menu Itemnav_menu_itemIndividual items inside a navigation menu

Beyond the five, WordPress also registers several internal post types for editor features, such as:

Post TypeSlugPurpose
Custom CSScustom_cssTheme customizer custom CSS storage
Patternwp_blockBlock editor patterns (called “Reusable Blocks” before WP 6.3; synced patterns save content to this CPT)

You will never register any of these yourself — WordPress creates them automatically. Everything else is a custom post type.


Registering a Custom Post Type with Code

The canonical way to register a CPT is register_post_type(), called on the init action hook. This is defined in wp-includes/post.php and documented in the WordPress Developer Reference.

function mytheme_register_project_post_type() {
    $labels = array(
        'name'               => 'Projects',
        'singular_name'      => 'Project',
        'add_new_item'       => 'Add New Project',
        'edit_item'          => 'Edit Project',
        'all_items'          => 'All Projects',
        'search_items'       => 'Search Projects',
        'not_found'          => 'No projects found.',
    );

    $args = array(
        'labels'            => $labels,
        'public'            => true,
        'has_archive'       => true,
        'rewrite'           => array( 'slug' => 'projects' ),
        'supports'          => array( 'title', 'editor', 'thumbnail', 'excerpt' ),
        'menu_icon'         => 'dashicons-portfolio',
        'show_in_rest'      => true,   // Required for block editor support
    );

    register_post_type( 'project', $args );
}
add_action( 'init', 'mytheme_register_project_post_type' );

Key register_post_type() Parameters

ParameterTypeWhat it controls
publicboolWhether the CPT appears in admin and on the front end
has_archiveboolEnables an archive page (e.g., /projects/)
rewritearrayCustom URL slug for single posts
supportsarrayWhich meta boxes appear: title, editor, thumbnail, excerpt, comments, revisions, etc.
menu_iconstringDashicon or URL for the admin menu icon
show_in_restboolExposes the CPT to the REST API and enables the block editor
hierarchicalbooltrue makes it behave like pages (parent/child); false like posts
taxonomiesarrayAssociate existing taxonomies (e.g., category)

The show_in_rest Flag

show_in_rest defaults to false. Setting it to true does two things:

  1. Registers a REST API route for the post type at /wp-json/wp/v2/{rest_base} — making items readable and writable via the REST API.
  2. Enables the Gutenberg block editor for that post type. Without this flag set to true, the classic editor is used.

If you want AI tools or external integrations to read and write CPT items through the REST API, show_in_rest => true is not optional — it is the prerequisite.

Flush Rewrite Rules After Registration

After registering a new CPT, WordPress’s rewrite rules need to be refreshed. The standard approach: on plugin or theme activation, call flush_rewrite_rules(). Avoid calling it on every request — it is expensive.

register_activation_hook( __FILE__, 'mytheme_flush_rewrites' );
function mytheme_flush_rewrites() {
    mytheme_register_project_post_type();
    flush_rewrite_rules();
}

Alternatively, visit Settings → Permalinks and click Save in the WordPress admin — this flushes rewrite rules without code.


Registering a Custom Post Type Without Code: CPT UI

Not every site owner wants to touch PHP. Custom Post Type UI (CPT UI), built by WebDevStudios, is the go-to solution for no-code CPT registration. It is used by more than 1,000,000 active WordPress sites and carries a 4.6 out of 5 star rating with 276 reviews.

CPT UI wraps register_post_type() and register_taxonomy() in a point-and-click admin interface. Every parameter you would set in code — labels, supports, rewrite slug, show_in_rest, hierarchical — has a corresponding field in the plugin’s UI.

Code vs. CPT UI: When to Use Each

Code (register_post_type())CPT UI plugin
Who it’s forDevelopers building themes or pluginsNon-developers; developers who want a fast UI
PortabilityTravels with the theme/pluginStored in wp_options; tied to plugin being active
Version controlYes — lives in PHP filesRequires export/import or separate tooling
FlexibilityFull; every parameter availableAll common parameters; edge cases may need code
Speed to set upSlower (write, push, test)Faster (click through admin screens)
REST API toggle'show_in_rest' => trueCheckbox in the UI
Deactivation riskNoneCPT disappears if plugin deactivated

For production sites with a development workflow, registering via code is preferred. For content-heavy sites managed by non-developers, CPT UI removes friction. The two can coexist — CPT UI for rapid prototyping, then migrated to code for production.


Pairing CPTs with Custom Taxonomies

A custom post type alone stores a content item. Custom taxonomies let you classify and filter those items.

WordPress’s built-in category and tag taxonomies belong to the post post type by default. You can associate them with a CPT using the taxonomies parameter in register_post_type() — or register a brand-new taxonomy with register_taxonomy().

function mytheme_register_project_taxonomy() {
    register_taxonomy(
        'project_type',         // taxonomy slug
        'project',              // associated post type
        array(
            'label'        => 'Project Types',
            'hierarchical' => true,   // true = categories; false = tags
            'rewrite'      => array( 'slug' => 'project-type' ),
            'show_in_rest' => true,
        )
    );
}
add_action( 'init', 'mytheme_register_project_taxonomy' );

Custom taxonomies appear as meta boxes in the post editor and as filterable admin columns. Combined with a CPT, they give you a fully structured content model without a database schema change.


Pairing CPTs with Advanced Custom Fields (ACF)

Out of the box, a CPT supports the standard WordPress fields: title, content area, excerpt, featured image. For structured data — a project’s client name, budget, completion date, gallery of screenshots — you need custom fields.

Advanced Custom Fields (ACF) is the most widely used plugin for this. ACF lets you define field groups and assign them to any post type. A project CPT might have:

  • client_name (Text)
  • project_url (URL)
  • completion_date (Date Picker)
  • featured_gallery (Gallery)
  • budget_range (Select)

ACF stores field values as WordPress post meta, accessible via get_field() in templates or the ACF REST API extension when REST is enabled. The CPT + ACF combination is the standard WordPress architecture for structured content — a portfolio, an events calendar, a product catalog without WooCommerce.


Managing Custom Post Types with AI via Easy MCP AI

Once your CPTs are registered and running, day-to-day content operations — creating items, updating fields, bulk-editing records — are the ongoing workload. That is where Easy MCP AI enters.

Easy MCP AI is a free, open-source WordPress plugin that turns your site into a fully compliant remote MCP server. It exposes 214 tools (96 core · 80 plugin · 38 data integrations) to any MCP-capable AI client — Claude, ChatGPT, Cursor, n8n, and 12 others. The 96 core WordPress tools include explicit support for custom post types: creating, reading, updating, and deleting CPT items through the same tool set that handles standard posts and pages.

What This Looks Like in Practice

After connecting Claude to your site via Easy MCP AI, you can manage CPT content in plain English:

  • “Create a new Project post titled ‘Acme Corp Redesign’ with status draft.”
  • “List all published Projects that have no featured image.”
  • “Update the excerpt on each of our last 10 Projects to a one-sentence summary.”
  • “Change the status of all Projects tagged ‘legacy’ to archived.”

For sites that also use ACF alongside their CPTs, Easy MCP AI’s ACF integration exposes 6 dedicated ACF tools — letting Claude read and write the custom field values on those CPT items, not just the post meta WordPress natively exposes.

Setup

Step 1 — Install Easy MCP AI from the WordPress plugin directory. Free, no usage limits.

Step 2 — Go to Easy MCP AI → Dashboard and copy your MCP server URL.

Step 3 — In Claude, go to Settings → Connectors → Add custom connector, paste the URL, and authorize via OAuth 2.1.

Step 4 — Start a conversation and ask Claude to manage your CPT content.

All operations run on your own server. Credentials are encrypted AES-256-GCM with per-provider HKDF-derived keys. Nothing leaves your WordPress installation until Claude explicitly calls a tool, and every action is gated by WordPress capability checks.


Key Facts

  • WordPress has five native post types: post, page, attachment, revision, and nav_menu_item.
  • register_post_type() must be called on the init action hook; it accepts two arguments — a post type slug and an args array.
  • show_in_rest => true is required to both expose a CPT to the REST API and enable the Gutenberg block editor for that post type. It defaults to false.
  • After registering a new CPT, rewrite rules must be flushed — either programmatically on plugin activation or by saving the Permalinks settings page.
  • Custom Post Type UI (CPT UI) is active on over 1,000,000 WordPress sites; it wraps register_post_type() in an admin UI and stores config in wp_options.
  • The standard production architecture for structured content is: CPT + custom taxonomy + ACF custom fields.
  • Easy MCP AI exposes 214 tools including core support for custom post types, letting AI clients create and manage CPT items through natural language.

Conclusion

WordPress custom post types are the correct solution any time you need structured content that isn’t a blog post or a page. Whether you register them in PHP with register_post_type() or reach for the CPT UI plugin, the pattern is the same: define the content model, attach taxonomies for classification, attach ACF for custom fields, and set show_in_rest => true if you want block editor support or REST API access.

For teams managing large volumes of CPT content, Easy MCP AI bridges the gap between your WordPress data model and AI assistants — letting Claude create, update, and audit CPT items without opening the admin.

Get Easy MCP AI from the WordPress plugin directory


Official Sources

Ready to control WordPress with AI?

Install Easy MCP AI on your site and connect Claude, Cursor, or any AI assistant in minutes.

Related Posts

Newsletter

The AI + WordPress space moves fast. Keep up.

New tools, workflow ideas, and product updates — be the first to know what's next.

No spam, unsubscribe anytime.