Skip to content
GPLWP Guides

How to create custom post types in WordPress

Developer Tools Time About 30–60 minutes for the coded route 6 steps Updated 27 Sep 2026

DEVELOPER TOOLS
The short answer

WordPress does not include a general dashboard screen for creating custom post types. You can register one in a plugin with PHP, add taxonomies and templates, or use a builder such as ACPT when you want to avoid coding.

The route
  1. 01Plan the content model
  2. 02Register it in a plugin
  3. 03Add taxonomies and fields
  4. 04Build the display templates
  5. 05Refresh permalinks and test
  6. 06Use a visual builder instead

What you need

  • Administrator or hosting access
  • A code editor or a safe way to add a small WordPress plugin
  • A staging site or recent backup
  • A clear content model for the new post type

Plan the content model

Decide what the content represents and whether it really needs its own post type. Use a custom post type for a distinct content type such as Books, Courses or Case Studies, rather than creating one for a small variation of a normal post.

Choose a short, lowercase machine name such as book. The post type key must be no more than 20 characters and should not clash with a reserved WordPress term. Keep the public URL slug separate from the internal key if you need a different URL.

Register it in a plugin

Put the registration in a site plugin or must-use plugin, not only in the theme. That keeps the content type registered when you change themes. Hook the registration to WordPress's init action and call register_post_type() with labels, visibility, archive behaviour, URL settings and editor features.

A minimal pattern looks like this: add_action( 'init', 'my_site_register_books' ); function my_site_register_books() { register_post_type( 'book', array( 'labels' => array( 'name' => 'Books', 'singular_name' => 'Book' ), 'public' => true, 'has_archive' => true, 'show_in_rest' => true, 'rewrite' => array( 'slug' => 'books' ), 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'revisions' ) ) ); } Use a unique prefix for your function name. The supports list controls features shown in the editor, while show_in_rest allows the post type to work with the block editor and REST API.

Add taxonomies and fields

Register a taxonomy when entries need grouping or filtering. Use register_taxonomy() for a category-like hierarchy or a tag-like, non-hierarchical set of terms, and associate it with your post type through the registration arguments or the appropriate object-type connection.

Custom fields are stored as post metadata. WordPress can expose its basic custom-fields interface, but a useful editor experience often needs a field-management plugin or additional meta-box code. Do not confuse a taxonomy with a custom field: taxonomies are for terms shared across many entries, while fields hold values belonging to one entry.

Build the display templates

Your new entries can initially fall back to the theme's normal templates. For a classic theme, add single-book.php for an individual entry and archive-book.php for the post type archive. For a block theme, use the corresponding templates in the theme's templates area, or design them in the Site Editor when supported.

WordPress checks the post-type-specific template before falling back to broader templates such as single.php, archive.php or index.php. Create a specific template only when the new content needs a different layout.

Refresh permalinks and test

After registering the post type, visit Settings > Permalinks and save the settings once. This rebuilds WordPress's rewrite rules and commonly fixes a new post type archive or single URL returning a 404.

If the post type is registered by a plugin, flush rewrite rules on plugin activation and deactivation rather than on every page load. Flushing on every request adds unnecessary work and can cause problems on busy sites. Also check that the rewrite slug does not conflict with a page, taxonomy or another post type.

Use a visual builder instead

The fast route is to install ACPT, create the post type from its visual interface, then add the fields, taxonomies, templates and permissions you need. This avoids writing and maintaining the registration code, which is useful when several content types or complex field groups are involved.

The manual route is still a good choice for a small, stable site feature that belongs in your site's own plugin. Use ACPT when you want to configure the structure quickly, give editors a clearer interface, or change the content model without editing PHP.

The fast route

Let ACPT do it

Visual builder for post types, fields, taxonomies, templates, and permissions when you want to avoid custom coding.

Get ACPT

Sources

  1. developer.wordpress.org /reference/functions/register_post_type/?utm_source=openai
  2. developer.wordpress.org /reference/functions/register_taxonomy/?utm_source=openai
  3. developer.wordpress.org /themes/templates/template-hierarchy/?utm_source=openai
  4. wordpress.org /documentation/article/what-is-post-type/?utm_source=openai

Questions

Can I create a custom post type without a plugin?
You need either a plugin or theme code because WordPress creates custom post types through PHP registration, not through a general built-in dashboard form. A small site plugin is the safer manual option because the post type remains available if you change themes. A visual builder such as ACPT is the alternative when you do not want to maintain PHP.
Should a custom post type go in a theme or plugin?
A custom post type should normally go in a site plugin or must-use plugin so the content does not disappear from the administrative area when the theme changes. The theme should control presentation through templates, while the plugin registers the content type, taxonomies and related data structure.
Why does my custom post type URL show a 404 error?
A custom post type URL usually shows a 404 because WordPress has stale rewrite rules, the post type is not registered on the current request, or its rewrite slug conflicts with another URL. Save Settings > Permalinks once after adding or changing the registration, and make sure the slug is unique. Plugin registrations should flush rules only during activation or deactivation.
What is the difference between a custom post type and a taxonomy?
A custom post type defines the kind of content you are storing, such as Books or Events. A taxonomy groups that content into reusable terms, such as Genre, Location or Topic. Use custom fields for values that belong to one entry, such as an ISBN, event date or venue, rather than for shared categories.
Which templates display a custom post type?
For a classic theme, WordPress looks first for a post-type-specific single template such as <code>single-book.php</code> and an archive template such as <code>archive-book.php</code>, then falls back to broader theme templates. Block themes use the equivalent block-template hierarchy. If no specific template exists, the content can still display through the theme's general templates.