How to Create Custom Post Types in WordPress (Step-by-Step)
Want to organize your WordPress content beyond posts and pages? Creating custom post types is the perfect solution. In this guide, you’ll learn exactly how to do it — with or without a plugin.
What Are Custom Post Types?
By default, WordPress includes two main post types: Posts and Pages. However, sometimes you need to manage other kinds of content like:
- Portfolios
- Testimonials
- Recipes
- Real estate listings
- Vehicles or products
This is where custom post types come in — they let you create separate content types that behave just like posts but are customized for your needs.
Method 1: Use a Plugin (No Code Required)
If you prefer not to touch code, a plugin is the easiest way to create custom post types.
✅ Recommended Plugin: Custom Post Type UI
Steps:
- Install and activate the Custom Post Type UI plugin.
- Go to
CPT UI → Add/Edit Post Types
. - Enter a slug (e.g.,
portfolio
) and a name (e.g., “Portfolio”). - Configure settings as needed (e.g., menu icon, support for custom fields).
- Click Add Post Type.
That’s it! Your new post type will now appear in the WordPress admin menu.
Method 2: Register a Custom Post Type Manually (With Code)
Prefer to keep things lightweight? You can register custom post types directly in your theme’s functions.php
file or via a custom plugin.
Example Code:
function register_portfolio_post_type() {
register_post_type('portfolio',
array(
'labels' => array(
'name' => __('Portfolios'),
'singular_name' => __('Portfolio')
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'portfolio'),
'supports' => array('title', 'editor', 'thumbnail', 'custom-fields'),
'menu_icon' => 'dashicons-portfolio',
)
);
}
add_action('init', 'register_portfolio_post_type');
This code registers a “Portfolio” post type with support for custom fields, thumbnails, and more.
How to Display Custom Post Types on Your Site
After creating a custom post type, you’ll likely want to show them on your site. Here are two common ways:
- Using Elementor: Use a Post widget and filter by post type.
- With PHP: Use
WP_Query
to loop through custom posts manually.
Enhance Your Custom Post Types with ACF
Pairing custom post types with Advanced Custom Fields (ACF) gives you even more flexibility. You can add fields like:
- Ratings
- Contact info
- Maps and images
- File uploads
ACF makes it easy to display this data with Elementor or PHP templates.
Bonus: SEO Benefits of Custom Post Types
Using custom post types improves your site structure and helps search engines understand your content. Combined with plugins like Yoast SEO or Rank Math, you can:
- Optimize custom post meta titles and descriptions
- Add schema markup using ACF
- Create targeted sitemaps