Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
custom fields

12 Useful WordPress Custom Post Type Tutorials (Updated for WordPress)

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

These 12 custom post type tutorials cover the decisions and implementation tasks that matter most: choosing the right content model, registering it safely, organizing and finding entries, exposing them on the front end or through the REST API, and migrating existing content. The list originated in a June 8, 2015 WPBeginner video, so the ideas remain useful but old code and plugin instructions should be checked against current WordPress documentation before use.

First: when do you need a custom post type?

Use a custom post type (CPT) when a content category has a distinct purpose, fields, editorial workflow, or presentation from ordinary posts and pages. Examples might include properties, events, courses, products, or team profiles. A CPT is a content model, not merely a second blog category.

  • Use categories or tags when the items are still regular posts that share the same fields and workflow.
  • Use a CPT when the items need their own labels, editor supports, taxonomies, archive behavior, or templates.
  • Use custom fields for attributes belonging to one item, and taxonomies for classifications shared across many items.

WordPress stores CPT entries in the standard posts table and provides core APIs for registering, retrieving, and rendering them. A third-party plugin is not technically required.

1. Register a custom post type correctly

Register the type on or after the init hook. The registration arguments are separate controls, so decide deliberately whether the type appears in the dashboard, is publicly queryable, supports search, has an archive, uses the block editor, and is exposed through the REST API.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
add_action( 'init', function () {
    register_post_type( 'book', array(
        'label'        => 'Books',
        'public'       => true,
        'show_in_rest' => true,
        'has_archive'  => true,
        'supports'     => array( 'title', 'editor', 'thumbnail' ),
        'taxonomies'   => array( 'genre' ),
        'rewrite'      => array( 'slug' => 'books' ),
    ) );
} );

The exact labels, supports, capabilities, rewrite slug, and visibility flags should match the site’s workflow. After changing rewrite settings, visit Settings > Permalinks and save once to refresh rewrite rules.

Code registration or a dashboard plugin?

Approach Best for Trade-off
PHP registration Developers who need version control and precise behavior Requires coding and deployment discipline
Plugin UI Administrators who prefer a dashboard workflow Behavior depends on that plugin and its configuration

If the content must survive a theme change, put the registration in a plugin rather than the theme. A theme switch can otherwise remove the type from the dashboard even though its records remain in the database.

2. Add a custom icon in the WordPress admin

An admin-menu icon helps editors distinguish a CPT from Posts and Pages. The registration’s menu_icon argument can use a built-in Dashicon name or an image URL. Choose an icon that reflects the content and test it at the menu size used by the current admin interface.

3. Create a CPT archive page

Set has_archive to true (or to a custom archive slug) when a conventional listing page is appropriate. WordPress can then query the type’s entries through its archive request, subject to your rewrite and template setup. A CPT does not automatically have an archive simply because it exists.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When a custom listing is better

Build a custom page or query when the listing needs filters, a nonstandard sort order, mixed content types, pagination rules, or a layout unlike a normal archive. Keep the query narrowly scoped to the required post type and validate pagination and empty-result states.

4. Add an RSS feed for one custom post type

A dedicated feed is useful when subscribers want only one content stream. Implement it with a feed request and a template that queries the CPT, then test the generated XML in a feed validator. Feed behavior depends on the site’s rewrite and query configuration, so do not copy a historical snippet without checking it against current WordPress feed APIs.

5. Include CPT entries in the main RSS feed

Including a CPT in the site-wide feed is a different requirement from creating a dedicated feed. Adjust the main feed query so the intended post types are returned, while preserving the normal ordering, publication status, pagination, and access rules. Decide whether subscribers should receive full content or excerpts in the feed settings and template.

6. Make a CPT searchable

Search visibility has several parts: the type must be publicly queryable, its entries must be published, and the search query must include that post type. Check the publicly_queryable, exclude_from_search, and related registration settings rather than assuming public enables every route.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Search fields are separate

WordPress’s default search primarily covers post titles and content. If visitors must search custom-field values, add a carefully scoped query modification or use a search system that indexes those fields. Test relevance, permissions, pagination, and performance with realistic data.

7. Make custom-type items sticky

Core sticky-post behavior is designed around the built-in Posts type. A CPT that needs “featured” or “pinned” entries generally requires its own implementation: a boolean field, taxonomy term, custom ordering value, or a query that promotes selected entries. Define what happens when several entries are featured and how the ordering works on archive, search, and API responses.

8. Disable Disqus comments for a custom post type

Comment controls must be handled at the WordPress and Disqus integration layers. Disable comments for the type in its registration or editor settings, then confirm that the Disqus embed does not load on its singular and archive-related templates. Also check existing entries, cached pages, REST responses, and moderation workflows; hiding the form alone does not necessarily disable stored comments.

9. Accept user-submitted content

User-submitted CPT entries require more than a front-end form. The submission workflow should validate and sanitize every field, enforce capability and authentication rules, protect against cross-site request forgery, limit uploads, and place new entries in a moderation status such as pending rather than publishing them automatically.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Define which fields are required and how invalid values are reported.
  • Use nonces and server-side capability checks; never rely only on browser validation.
  • Restrict file types and sizes, and store uploads through WordPress APIs.
  • Give moderators a clear review, revision, rejection, and deletion process.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

10. Convert existing content to or from a CPT

Converting a post changes its content type; it does not automatically redesign its fields, taxonomies, URLs, templates, or permissions. Make a database backup, test on staging, map old and new taxonomies, and plan redirects if the permalink structure changes. A plugin such as Post Type Switcher is one possible administration aid, but its current compatibility and workflow should be checked before production use.

Migration checklist

  1. List the source entries, authors, statuses, taxonomies, custom fields, media, and URLs.
  2. Register the destination type and supports before moving records.
  3. Run a small test conversion and inspect front-end, admin, search, feeds, and REST output.
  4. Convert the remaining entries in batches, recording failures.
  5. Refresh permalinks and verify redirects, internal links, sitemaps, and analytics.

11. Relate post types and taxonomies

Relationships should reflect the content model. Use a shared taxonomy when entries from one or more post types need common terms such as locations, subjects, or departments. Use a direct relationship field when one item refers to specific items, such as a course referring to instructors.

Register the taxonomy explicitly and connect it to the post type through the registration’s taxonomies argument. The connection and the taxonomy definition are related but distinct; configure both, then test term screens, REST responses, permissions, and archive URLs.

Taxonomy or custom field?

Need Prefer
Filter many entries by shared, reusable terms Taxonomy
Store a value that describes one entry, such as ISBN or event date Custom field
Link one entry to particular entries Relationship field or purpose-built relationship system

12. Add custom meta boxes and fields

Meta boxes expose structured attributes that do not belong in the main editor. You can register them with WordPress APIs or use a field-management plugin. Advanced Custom Fields (ACF) is a commonly used example in this tutorial category, but it is optional rather than a WordPress requirement.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose field types and validation rules from the content model: dates should have an unambiguous format, numbers should be stored as numbers, and repeated values should have a defined structure. Escape values when rendering them and restrict editing to the capabilities that should control the field.

Public website, block editor, and REST API are separate decisions

A type can be visible on the public site yet unavailable through the REST API, or available in the API without having a public archive. show_in_rest => true is important for REST exposure and block-editor support, but it does not by itself decide front-end visibility, search inclusion, or archive behavior. Check the dedicated WordPress REST API guidance when building headless interfaces, custom blocks, or external integrations.

A practical build order

  1. Write down the content’s fields, editorial roles, classifications, relationships, URLs, and required views.
  2. Register the CPT in a plugin with only the supports and visibility settings you need.
  3. Register and connect taxonomies, then add custom fields and validation.
  4. Build the single template, archive or custom listing, search behavior, and any feeds.
  5. Add REST support if the block editor or an external client needs it.
  6. Test permissions, drafts, previews, revisions, comments, feeds, redirects, empty states, and responsive output on staging.
  7. Document the model so another administrator can maintain it without changing the theme.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.