MODULE 03 · FUNCTIONALITY & CUSTOMIZATION

Custom Post Types

Posts and Pages cover blogs and static content, but real sites need more — Portfolios, Testimonials, Products, Team Members. Today you'll create your first Custom Post Type and give it its own place in the dashboard.

Day 19 of 30 Intermediate ~20 min

Beyond Posts and Pages

Every piece of content in WordPress — a post, a page, even a media attachment — is stored as a "post type" under the hood. Posts and Pages are just the two built-in types. A Custom Post Type (CPT) lets you define a brand-new content type with its own admin menu, its own icon, and its own fields, completely separate from your blog posts.

If you've ever wondered how a site lists "Portfolio Items" or "Testimonials" in its own sidebar menu instead of mixing them into regular posts, that's a Custom Post Type doing the work.

What's Already There

Before creating anything new, it helps to see what WordPress already ships with — so you don't rebuild something that already exists.

POST TYPE WHAT IT'S FOR
Post

Time-based, chronological content — blog entries, news updates, articles.

Page

Static, standalone content that isn't part of a chronological feed — About, Contact, Home.

Attachment

Every file uploaded to the Media Library, stored internally as its own post type.

Custom Post Type

Anything you define yourself — Portfolio, Testimonial, Team Member, Recipe, and so on.

THINK OF IT AS

If content doesn't fit naturally as a blog post or a static page, it probably deserves its own custom post type.

Plugin UI vs Code

custom-post-type.txt
// The two common approaches
CPT UI plugin  // point-and-click form, no code required
register_post_type() // a PHP function added to your theme or a plugin

Both approaches register the same thing behind the scenes — one just does it through a form.

Using the CPT UI Plugin

  • Install and activate the free "Custom Post Type UI" plugin from Plugins → Add New.
  • Go to CPT UI → Add New in the admin sidebar.
  • Set the Post Type Slug — a short, lowercase name like portfolio.
  • Fill in the plural and singular labels — "Portfolio Items" and "Portfolio Item".
  • Enable the settings you need — featured image, custom fields, Gutenberg editor support.
  • Click Add Post Type and check the new menu item that appears in your sidebar.
  • Which Approach Should You Use?

    PLUGIN-ONLY SITES Relying only on a plugin's UI means the post type disappears the moment the plugin is deactivated — including all its content settings.
    CODE FOR PORTABILITY Registering a post type with register_post_type() in your theme keeps it working even if you switch plugins later — the CPT UI plugin can even export the code for you.

    Common Custom Post Type Mistakes

    WATCH FOR THESE
    SLUG TOO LONG Post type slugs must stay under 20 characters or WordPress will silently reject the registration.
    FORGETTING PERMALINKS New post types often show a 404 on their own pages until you resave Settings → Permalinks once.
    "SHOW IN REST" OFF Leaving this disabled hides the post type from the Gutenberg block editor and blocks API access.

    Breaking Down What You Just Learned

    1

    Everything is a post typePosts, Pages, and attachments are all built-in post types under the hood.

    2

    CPTs get their own spaceA custom post type earns its own sidebar menu, separate from posts and pages.

    3

    Two creation pathsThe CPT UI plugin offers a form; register_post_type() offers code-level control.

    4

    Code survives plugin changesA post type defined in code keeps working even without the original plugin active.

    5

    Resave permalinksNew post types need a permalink flush before their pages will load correctly.

    Try It Yourself

    EXERCISE

    Use CPT UI to create a "Testimonials" post type with the slug testimonial. Enable the featured image and custom fields options, then add one sample testimonial entry.

    Add a Custom Post Type to Your Capstone Site

    HANDS-ON EXERCISE

    Giving your capstone site its own content type

    By the end of today, your capstone site should have a working custom post type with at least two published entries.

    1. Install the Custom Post Type UI plugin.
    2. Create a post type that fits your capstone site — Portfolio, Testimonial, or Team Member.
    3. Set clear singular and plural labels and a short, valid slug.
    4. Resave Settings → Permalinks so the new URLs work.
    5. Add two sample entries and confirm both display on the front end.

    Recap

    POST TYPE

    The underlying content category WordPress uses for posts, pages, and anything custom.

    CPT UI PLUGIN

    A form-based way to register a new post type without writing code.

    register_post_type()

    The PHP function that defines a post type in code for long-term portability.

    PERMALINK FLUSH

    Resaving permalink settings so new post type URLs stop returning 404s.

    Key Takeaways

    • Posts and Pages are built-in post types — Custom Post Types work the same way but hold different kinds of content.
    • Custom Post Types give content like Portfolios or Testimonials their own dedicated admin menu.
    • The CPT UI plugin creates a post type through a form; register_post_type() does it in code.
    • Code-based registration keeps working even if you later remove the plugin used to build it.
    • Always resave permalinks after adding a new post type to avoid 404 errors.
    Course Overview