Learn How To Create WordPress Custom Post Type and Custom Taxonomies

WordPress Custom Post Type

Quick Summary: WordPress has set its foot firmly in the digital world to create websites without getting messed up with code. This widely used CMS allows you to create a variety of content through WordPress Custom Post Type. Let’s take a look at what it is all about and the great functionality it offers.

LearnMate Theme

If you’ve ever wondered why there is a need for WordPress custom post types, I’m here to help you out. No doubt, creating websites using WordPress is a great and easy way to put your feet into the digital world. But there are some limitations too in WordPress default “Post Types”. WordPress default posts include

  1. Post (Post Type: ‘post’)
  2. Page (Post Type: ‘page’)
  3. Attachment (Post Type: ‘attachment’)
  4. Revision (Post Type: ‘revision’)
  5. Navigation menu (Post Type: ‘nav_menu_item’)

Sometimes you’ve thought of creating something different from these post types. For example, you want to create content for reviews, testimonials, Forms or something else that a default post type can’t serve the purpose. Hence, the need arises for WordPress Custom Post Type.

So, let’s dig out what Custom Post Type is all about!

Understanding WordPress Custom Post Type (CPT)

WordPress Custom Post Type (also referred to as CPT) is a perfect solution that allows creating a variety of content on your WordPress website other than the default WordPress Post Types.

After registering Custom Post Types, you can easily manage and create posts of that type. In order to register your own custom post type, you need to use a function register_post_type()


[alert style=”warning”]We never recommend you to put your custom post type in your WordPress theme. Rather, use custom post types in a WordPress Plugin. This allows user content remains portable even if you change your WordPress Theme.[/alert]


Here are some of the templates that you can use to display Custom post types:

  • single-{post-type}.php
  • archive-{post-type}.php
  • search.php
  • index.php

So, Custom Post Type is a different post_type value that can be stored in WordPress database. These post types can be anything like reviews, testimonials, Forms, products, books, movies, or anything else.

3 Facts To Be Known About Custom Post Types

Custom Post Type

  1. Once the custom post type has been created, you may access it from the back end of your WordPress site as a separate menu item. It will contain its own post list and “add new” page.
  2. The navigation URL of the archive page of your custom post type will be http://example.com/customposttype/
  3. You can use categories and tags for the custom post type or you can also create custom taxonomies.

Important Note: Different post types have their own specifications. For example, if you’re creating a regular post, you would like to display the author, category, and date for your posts. similarly, if you are creating a custom post type for a movie, you would like to display the genre, director, producer, star cast, etc. So, what information needs to be displayed, solely depends on the type of content you’re creating on your site.

Understanding Custom Taxonomy

WordPress taxonomy is a way to group posts together depending on a select number of relationships. By default, a standard post has 2 types of taxonomy – Categories and Tags.

But you can also remove or change, and add more taxonomies if you like. The taxonomies you’ll create by yourself are termed as custom taxonomies. Custom taxonomies are commonly used to create a different set of categories for your Custom Post Type.

Let’s  understand it with an example:

If you have a Custom Post Type called “movies”. You can now create a separate set of categories for the movies on your website. You can organize them by genre using a custom taxonomy called “Genres”. You can then include Action, Adventure, Comedy, Drama, Epics/Historical, Horror movies, etc. in this Custom Post Type.

Using the “object type” parameter in register_taxonomy function, you can show this particular set of category for your Custom Post Type.

Important Note: WordPress creates an “archive” page for all custom post type and custom taxonomy that you make using has_archive code.

How to display posts in CPT?

Here is an example to understand:

I’m going to register a Custom Post Type “Movies” using the following code:

function codex_custom_init() {
$args = array(
‘public’ => true,
‘label’ => ‘Movies’,
‘has_archive’ => true
register_post_type( movies’, $args );
add_action( ‘init’, ‘codex_custom_init’ );[/code]


[idea]Also, check out:

How to Fix WordPress Custom Post Type 404 Error[/idea]



So, this is all about creating WordPress custom post type and Custom Taxonomy. Hope you’ve understood well. Think about your niche requirements and then create your own custom post types as well.

Leave a comment below if you have any doubts or queries.





Get tips, product updates, and discounts straight to your inbox.


This field is for validation purposes and should be left unchanged.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.