How to Create Custom Post Types in WordPress


We all know that WordPress is the best blogging platform but it is not just limited to being a blogging platform. It allows us to create any kind of website without even knowing the coding. There are so many WordPress themes that take benefits of custom post type feature of WordPress and allow us to have any kind of website. So, custom post type is an important thing to know if you are starting with WordPress. In this article, I will explain what is custom post type and how you can create a custom post type in WordPress.

We Recommend Bluehost

What is Custom Post Type in WordPress?

In WordPress, we have different kinds of default post types. These default post types are:

  • Post
  • Page
  • Attachment
  • Revision
  • Nav Menu

But, you can also create your own post type to manage a different category of post in a separate way. If you create a new post type on WordPress other than using default one, this called Custom Post Type.

For example, if you want to create an event website, you will think of having a different post type for event booking. On Techlomedia, the theme has a different post type for reviews. There could be more like coupons, testimonials or portfolio.

How to Create Custom Post Types

Creating a custom post type on WordPress is not difficult. You can either do it by using a WordPress plugin or you can add code in the functions.php file. I will explain both ways here.

Easy Way: Creating custom post type with CPT UI

Custom Post Type UI or CPT UI plugin is the easiest way of creating a custom post type in WordPress. Not just post types, you can also add new taxonomies with the help of this plugin.

Note: The custom post type will remain on your blog until you have this plugin. If you uninstall the plugin, your custom post type will stop working.

Install and activate this plugin. It will add a new menu item ‘CPT UI’ in your WordPress admin menu. Navigate to CPT UI -> Add New to create a new custom post type in your WordPress website.

Creating custom post type with CPT UI

Enter the Post Type Slug and labels to add a new post type.

The next section on the page asks for additional information. You can provide those additional labels as per your interest.

Creating custom post type manually

With the plugin, you do not need to worry about complexities and you can easily create a custom post type. If you think to do the same manually, you will have to put lots of efforts.

The most basic code of creating custom post type is this.

This code will register a post type ‘coupon’ with an array of arguments. But there can be a detailed piece of code with more options to custom post type.

You can read more about this in detail here.

How to display Custom Post Types on Your Site

WordPress comes with built-in support for displaying custom post types. Once you added the code or created the custom post type with the plugin, you can start accessing it with the slug you provided.

For example, if you provided ‘coupons’ slug for your coupon custom post type, you can access it like this:

Here, replace the with your website’s domain name.

You can also create a dedicated archive and a single page for your custom post type. For this, you just need to copy your theme’s archive.php file into archive-coupons.php and put the code for an archive. You can also create a single-coupons.php file to put the single page code.

It is worth to note that custom post types will not come in between your regular posts. This is the primary advantage of it.

I have already written an article on how to include custom post type in blog’s RSS feed. You can also create a separate feed for each custom post type.

There could be many more things you can do. Covering everything in a single article is not possible. If you have anything specific to ask, you can comment below.

Final Words

I didn’t go into deep because there could be lot more things including the styling and theming. I just tried to explain how you can create a custom post type in WordPress to manage your content in a better way or creating a different kind of website. Custom Post Types are extremely useful and you can take advantage of it to create a website for real estate, movies, coupons, jobs and more.

I hope this post helps. If you have anything to ask, you can comment below.



Written by Deepanker

Deepanker Verma is the founder of Techlomedia. He is a tech blogger, developer and gadget freak.

Leave a Reply

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


voux magazine theme

15+ Magazine WordPress Themes For News, Tech, Fashion and Other Magazine Style Websites 2017

What is Gravatar?

What Is Gravatar And Why Should You Know About It?