WordPress supports multiple post types beyond just ‘Posts’ and ‘Pages,’ allowing users to organize content efficiently. Custom post types help structure different kinds of content, such as portfolios, testimonials, or products, improving user experience and site management.
WordPress is a powerful content management system (CMS) that organizes content using post types. A post type defines the kind of content stored in WordPress. By default, WordPress includes:
- Posts – Regular blog content.
- Pages – Static pages like “About Us” or “Contact.”
- Attachments – Media files like images and videos.
- Revisions, Menus, and Custom CSS – Other built-in content types.
However, WordPress is not limited to these! You can create Custom Post Types (CPTs) to structure content based on your needs. For example, an eCommerce site might have a “Products” post type, while a real estate website may use “Listings.”
Why Use Multiple Post Types?
Using different post types helps to:
- Improve content organization – Keep different content separate and easy to manage.
- Enhance user experience – Visitors can browse structured content easily.
- Boost SEO – Search engines prefer well-organized websites with structured content.
By leveraging multiple post types, WordPress users can customize their sites for better functionality, improved navigation, and efficient content management.
Default Post Types in WordPress
WordPress comes with several built-in post types that help organize content efficiently. These post types allow users to manage different kinds of content separately. Here are the default post types in WordPress:
1️⃣ Posts (For Blog Content)
Posts are used for blog articles and news updates. They appear in reverse chronological order (newest first) and can be categorized using categories and tags. Example: A blog post titled “10 Best Skincare Tips.”
2️⃣ Pages (For Static Content)
Pages are used for static content like the Home, About, Contact, or Privacy Policy pages. Unlike posts, pages do not have categories or tags and are not listed in a blog feed.
3️⃣ Attachments (For Media Files)
Whenever you upload images, videos, or other media to WordPress, they are stored as attachments. Each attachment gets a unique URL and can be embedded into posts and pages. Example: A product image uploaded to a WooCommerce store.
4️⃣ Revisions (For Post History)
WordPress automatically saves different versions of posts and pages as revisions. This allows users to restore previous versions if needed. Example: If you accidentally delete a paragraph, you can restore the older version from the revision history.
5️⃣ Navigation Menus (For Custom Menus)
WordPress allows users to create custom menus using the Navigation Menus post type. These menus help organize website navigation. Example: A menu with links to Home, Blog, and Contact pages.
6️⃣ Custom CSS & Changesets (For Theme Customization)
Custom CSS stores any additional styling changes made through the WordPress Customizer. Changesets are used to temporarily save customizer settings before publishing them. Example: A website owner adds custom CSS to change button colors.
These default post types make WordPress flexible and easy to manage for different content needs.
What Are Custom Post Types (CPTs)?
Custom Post Types (CPTs) are special content types in WordPress that go beyond the default options like Posts and Pages. They allow website owners to organize content more efficiently based on specific needs.
CPTs help separate different types of content so that they function and display uniquely on a website. Instead of using regular posts for everything, CPTs make content management easier and more structured.
When Do You Need Custom Post Types?
Custom Post Types are useful when a website needs specialized content that doesn’t fit under regular posts or pages. Here are some common examples:
✔️ Portfolio – Showcases work samples, case studies, or projects. Example: A designer displays their graphic design projects.
✔️ Testimonials – Stores customer feedback and reviews. Example: A business website features client testimonials with ratings.
✔️ Products – Used in WooCommerce stores to manage products separately. Example: An eCommerce store lists “T-Shirts” as a product category.
✔️ Events – Manages event listings with dates, locations, and details. Example: A concert website displays upcoming events with booking options.
How Multiple Post Types Work in WordPress?
WordPress allows multiple post types to exist and function separately. Each post type is stored in the database and managed through different sections of the WordPress admin panel. Here’s how multiple post types work:
1️⃣ Each Post Type is Registered Separately
Custom Post Types (CPTs) are created using PHP code inside a theme’s functions.php
file or through a custom plugin. Example: A “Portfolio” post type can be registered to showcase projects separately from blog posts.
2️⃣ Stored in the WordPress Database
All post types, including default ones (Posts, Pages) and CPTs, are stored in the wp_posts
database table. The post_type
column determines whether an entry is a post, page, product, or custom post type.
3️⃣ WordPress Queries Fetch Different Post Types
WordPress uses queries to retrieve specific post types when displaying content. For example:
- The blog page fetches posts using
post_type='post'
- An eCommerce store fetches products using
post_type='product'
This makes sure each post type is displayed correctly based on its function.
4️⃣ Admin Panel Management
Each post type appears separately in the WordPress Dashboard under its own menu. Example: If you register a “Testimonials” post type, a new menu item called “Testimonials” will appear, making it easy to manage customer reviews.
How to Create a Custom Post Type (CPT)?
Creating a Custom Post Type (CPT) in WordPress allows you to organize content efficiently. There are two main methods to create a CPT: using code or using a plugin.
Method 1: Using Code (functions.php or Plugin Development)
If you prefer coding, you can manually register a CPT using PHP. Add the following code to your theme’s functions.php file or inside a custom plugin:
function create_custom_post_type() {
register_post_type('portfolio',
array(
'labels' => array(
'name' => __('Portfolios'),
'singular_name' => __('Portfolio'),
),
'public' => true,
'has_archive' => true,
'supports' => array('title', 'editor', 'thumbnail'),
'menu_icon' => 'dashicons-portfolio',
)
);
}
add_action('init', 'create_custom_post_type');
Explanation:
register_post_type('portfolio', …)
→ Creates a new post type called “Portfolio.”public => true
→ Makes it visible in the dashboard.has_archive => true
→ Enables archive pages for portfolios.supports
→ Allows title, editor, and featured image for portfolio posts.menu_icon
→ Adds a portfolio icon in the WordPress admin panel.
After adding this code, you will see a new “Portfolios” menu in the dashboard where you can create and manage portfolio entries separately from posts and pages.
Method 2: Using a Plugin (No Coding Required!)
If you don’t want to edit code, you can use a plugin to create Custom Post Types easily. Here are two popular plugins:
1. Custom Post Type UI (CPT UI)
1️⃣ Install & Activate Custom Post Type UI from the WordPress plugin directory.
2️⃣ Go to CPT UI → Add New Post Type.
3️⃣ Enter the Post Type Slug (e.g., “portfolio”).
4️⃣ Set Labels, Visibility, and Features.
5️⃣ Click “Add Post Type.”
Your new CPT will appear in the admin menu instantly!
2. JetEngine (For Advanced CPT Features)
JetEngine is a powerful plugin for Custom Post Types, Custom Fields, and Dynamic Content.
1️⃣ Install & Activate JetEngine (by Crocoblock).
2️⃣ Go to JetEngine → Post Types → Add New.
3️⃣ Configure fields like title, editor, thumbnail, and meta fields.
4️⃣ Save the settings, and your CPT is ready!
Using a plugin is the easiest way to create and manage CPTs, especially for beginners.
Which Method Should You Use?
- For developers → Use PHP code for more flexibility and control.
- For beginners → Use Custom Post Type UI or JetEngine to avoid coding.
By using Custom Post Types, you can create structured, well-organized, and professional WordPress websites!
Customizing Custom Post Types in WordPress
Once you create a Custom Post Type (CPT), you may need to customize it further for better organization and display. Here are three key ways to enhance CPTs:
1️⃣ Adding Custom Fields & Metaboxes
Custom fields allow you to store extra information for your CPT, like project details in a portfolio or client names in testimonials.
Option 1: Using Advanced Custom Fields (ACF) Plugin (No Coding Required)
1️⃣ Install & activate the Advanced Custom Fields (ACF) plugin.
2️⃣ Go to Custom Fields → Add New.
3️⃣ Create fields like Client Name, Project Date, Budget, etc.
4️⃣ Assign them to the Portfolio post type.
5️⃣ Save & update your posts with the new fields.
ACF makes it easy to add and display structured data without writing code.
Option 2: Using Manual Code (For Developers)
Add this code to functions.php to create a custom metabox for CPTs:
function add_portfolio_meta_box() {
add_meta_box(
'portfolio_details',
'Portfolio Details',
'portfolio_meta_box_callback',
'portfolio',
'normal',
'high'
);
}
add_action('add_meta_boxes', 'add_portfolio_meta_box');
function portfolio_meta_box_callback($post) {
$client = get_post_meta($post->ID, '_client_name', true);
echo '<label>Client Name:</label>';
echo '<input type="text" name="client_name" value="' . esc_attr($client) . '" />';
}
function save_portfolio_meta($post_id) {
if (array_key_exists('client_name', $_POST)) {
update_post_meta($post_id, '_client_name', sanitize_text_field($_POST['client_name']));
}
}
add_action('save_post', 'save_portfolio_meta');
This adds a “Client Name” field inside Portfolio posts in the WordPress dashboard.
2️⃣ Custom Taxonomies (To Categorize CPTs)
Custom taxonomies help organize CPTs better, just like categories and tags work for blog posts.
Example: Creating a “Project Type” Taxonomy for Portfolios
Add this to functions.php:
function create_portfolio_taxonomy() {
register_taxonomy(
'project_type',
'portfolio',
array(
'label' => __('Project Type'),
'rewrite' => array('slug' => 'project-type'),
'hierarchical' => true,
)
);
}
add_action('init', 'create_portfolio_taxonomy');
This allows you to categorize portfolio projects into types like “Web Design” or “Graphic Design.”
3️⃣ Custom Templates for Displaying CPTs
By default, CPTs use the standard WordPress templates, but you can create custom templates for better display.
Single CPT Template (For Individual Posts)
To customize single portfolio pages, create a file called single-portfolio.php
in your theme folder and add:
<?php get_header(); ?>
<main>
<?php while (have_posts()) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<div><?php the_content(); ?></div>
<?php endwhile; ?>
</main>
<?php get_footer(); ?>
This ensures that each portfolio post has a unique layout.
Archive CPT Template (For Listing All CPTs)
For a Portfolio Archive page, create archive-portfolio.php
in your theme folder:
<?php get_header(); ?>
<main>
<h1>Our Portfolio</h1>
<div class="portfolio-list">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php endwhile; endif; ?>
</div>
</main>
<?php get_footer(); ?>
This creates a Portfolio listing page that displays all portfolio projects.
Querying Multiple Post Types in WordPress
By default, WordPress retrieves posts from a single post type (like blog posts). However, sometimes you need to fetch data from multiple post types at the same time. This is where WP_Query comes in.
Using WP_Query to Fetch Multiple Post Types
You can use the following PHP code to fetch posts from different post types, such as blog posts, portfolios, and testimonials:
$args = array(
'post_type' => array('post', 'portfolio', 'testimonial'), // Multiple post types
'posts_per_page' => 5, // Limit to 5 posts
'orderby' => 'date',
'order' => 'DESC',
);
$query = new WP_Query($args);
if ($query->have_posts()) :
while ($query->have_posts()) : $query->the_post();
echo '<h2><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>';
endwhile;
wp_reset_postdata();
else :
echo 'No posts found.';
endif;
When & Why Use Custom Queries for CPTs?
1. To Display Multiple Content Types in One Section
For example, if you’re creating a homepage feed that combines blog posts, portfolio projects, and customer testimonials, you need to fetch all three post types together.
2. To Customize the Display Order & Filtering
- Fetch only recent posts from selected post types.
- Filter posts based on categories, tags, or custom fields.
- Show posts from specific authors or exclude certain post types.
3. To Create Custom Archive Pages
If you want a single page to list different content types (e.g., “Our Latest Work” showing both portfolio projects and blog articles), you must manually query multiple post types.
Example Use Case: Displaying Portfolio & Blog Posts Together
If you have a section on your homepage called “Latest Updates”, where you want to display a mix of blog articles and portfolio items, you can use the WP_Query
method above to retrieve both posts and portfolio items at once.
This gives users a diverse and engaging browsing experience while keeping content structured and relevant.
SEO & Performance Considerations for Multiple Post Types
Using multiple post types in WordPress can enhance content organization, but it’s essential to optimize them for SEO and performance to ensure your website runs smoothly and ranks well in search engines.
SEO Optimization for Custom Post Types
1. Set Up SEO-Friendly URLs
By default, custom post types may have non-SEO-friendly URLs like: example.com/?post_type=portfolio&p=123
Instead, you should use SEO-friendly URLs like: example.com/portfolio/project-name
When registering a Custom Post Type (CPT), ensure you define user-friendly permalinks using the rewrite
parameter in register_post_type()
.
Example of SEO-friendly CPT registration:
register_post_type('portfolio',
array(
'rewrite' => array('slug' => 'portfolio'), // Creates URLs like /portfolio/project-name/
'public' => true,
)
);
Why?
- Makes URLs readable and search engine-friendly.
- Helps improve indexing of CPTs on Google.
2. Use Yoast SEO or Rank Math for CPT Metadata
By default, CPTs don’t include meta titles, descriptions, or structured data for SEO. Plugins like Yoast SEO or Rank Math allow you to:
- Add meta titles and descriptions for each CPT.
- Enable CPT indexing for search engines.
- Generate sitemaps for custom post types.
Steps to enable CPT SEO in Yoast SEO:
1️⃣ Go to SEO → Search Appearance in WordPress.
2️⃣ Click on the “Content Types” tab.
3️⃣ Enable indexing for your custom post type (e.g., Portfolio).
4️⃣ Customize SEO titles & meta descriptions for better rankings.
Performance Considerations for Multiple Post Types
1. Avoid Too Many CPTs If Unnecessary
If your website needs different content structures, CPTs are useful, but don’t overuse them. Sometimes, custom taxonomies (categories & tags) work better than CPTs.
When to Use CPTs?
- If the content needs a unique display & layout (e.g., Portfolio).
- If it requires custom fields & structured data.
When Not to Use CPTs?
- If the content is closely related to blog posts, use categories & tags instead.
2. Optimize Queries to Prevent Slow Database Performance
Using too many WP_Query calls can slow down your site. Optimize queries by:
- Limiting the number of posts per query (
posts_per_page
). - Using object caching to reduce database queries.
- Indexing database tables to speed up retrieval times.
Example of an optimized CPT query:
$args = array(
'post_type' => 'portfolio',
'posts_per_page' => 6, // Limit to 6 posts per query
'no_found_rows' => true, // Prevents unnecessary pagination queries
'cache_results' => true, // Improves performance
);
$query = new WP_Query($args);
This helps reduce database load and improve site speed.
Conclusion
Using multiple post types in WordPress makes it easier to manage different types of content, keeping everything structured and user-friendly.
Recap of Key Benefits:
- Better content organization – Separates different content types.
- Improved SEO & indexing – Custom post types rank better when optimized.
- More customization options – Allows unique layouts and structured content.
When to Use CPTs vs. Taxonomies?
- Use CPTs for entirely different content types (e.g., Portfolios, Products).
- Use Taxonomies for categorizing similar content (e.g., Blog topics).
Best Practices for Managing Multiple Post Types:
- Optimize URLs & metadata for SEO (use Yoast or Rank Math).
- Limit unnecessary CPTs (use taxonomies when possible).
- Use efficient queries to maintain site speed.
By following these best practices, your WordPress site will be faster, better organized, and SEO-friendly, leading to better user experience and higher search rankings!