How to Create Custom Post Types in WordPress

Do you want to know about custom post types and their purpose of using? Basically, they enable you to go behind your posts and pages. And help to build different content types for your WordPress site.

They are necessary if you want to allow your visitors or users to submit content. To provide submission access, you have to know how to add custom post types. 

The custom post types convert a WordPress site from the blogging platform into a powerful CMS (Content Management System).

In this article, we will discuss this post type and show you when you will need them. Then finally the ways of adding them to your WordPress site. Therefore, you will get to know two methods and can choose which one seems easier to you.

When You Need A Custom Post Type or Taxonomy?

need custom post type

Apparently, you can add/ create any kind of content in WordPress posts. Plus, add tags and categories with them. In some cases, you may need to follow different ways.

Here we are describing some signs which indicate that you should add custom post types or taxonomy. In fact, sometimes you may need both of them. Take a look at below-

  • When some content doesn't look or feel like a post. For example, weDevs Coupon
  • It doesn't require to be part of the temporal order of entries. 
  • Categories and tags are not helping you to do group and class that particular content. 
  • When you require to add more fields to insert more data with your content.
  • The content is not able to be a part of your pages. For Example, Blueprint of a page. 
  • When you need to show that particular content separately than posts.

However, let's proceed to the details.

Custom Post Types and Taxonomies – at a Glance

what are custom post types

The way to distinguish between different content types in WordPress is known as custom post types. For example, do you know that posts and pages are the same post types?

Hence, in WordPress, there are five default post types. 

  • Pages
  • Attachments
  • Navigation menus
  • Revisions
  • Posts

On the other side, Taxonomy is a thing that most people use in WordPress but they are not aware of it. Basically, it is a way to assort the posts and custom post types unitedly. There are two default Taxonomies in WordPress – Categories and Tags. 

However, you may need to extend more than these two options. As we know, WordPress is super-friendly, it enables you to create your own custom taxonomies. And, you can use them as your post types to classify your content.

How to Add Custom Post Type in WordPress

ultimate frontend solution for custom post types

There are two simple ways to create a custom post type in WordPress. One is adding code in your WordPress and the other one is using a plugin. You can follow either one consecutively.

1. Add Custom Post Type by Using Code

To submit a custom post type navigate to function.php file from WordPress for any particular theme. Add the following code there.

/* Custom Post Type Start */ function create_posttype() { register_post_type( ‘news', // CPT Options array( ‘labels' => array( ‘name' => __( ‘news' ), ‘singular_name' => __( ‘News' ) ), ‘public' => true, ‘has_archive' => false, ‘rewrite' => array(‘slug' => ‘news'), ) ); } // Hooking up our function to theme setup add_action( ‘init', ‘create_posttype' ); /* Custom Post Type End */

The news post-type will automatically appear after adding this code in the admin area of the WordPress dashboard. 

2. Add Custom Post Type with WP User Frontend

use wp user frontend to create custom post types

To create custom post types with a WordPress Plugin, we will show you how to do the job by using WP User Frontend as an example. It is super easy to install WP User Frontend on your site.

After the installation, you need to create a form, then your user can use it form the frontend. Now, follow the steps we are mentioning below to know how to create custom post types at ease.

Step 1: Install WP User Frontend

Click on the plugin from the left side of your dashboard. Search WP User Frontend and install it. 

Step 2: Creating a form 

how to add form in WPUF

Navigate through WP User Frontend > Post Forms > Add New. Create your form with necessary form fields. Save the form.

Step 3: Setting Post Status

After creating a form you have to navigate through WP User Frontend > Post Forms.

Edit the existing form by selecting Settings > Post Settings > Post Status.

You will be able to see the custom post types there. Select your post type and save the form.

Step 4: Creating Taxonomy 

creating taxonomy

Next, you have to go back to Form Editor, then under the taxonomy section, you can see custom taxonomy.

For Woocommerce there will be product categories, product tags. Now save the form.

Step 4: Create the Page

create page

To create a new page, copy the shortcode of your form, or edit an existing one. Paste the shortcode. View the page in the browser. Your custom post type submission is complete.

For your better understand there is a short video for you. Go through it and make your Custom Post Type form within a few moments.

Create Custom Post Type Form

Final Verdict on Custom Post Type

So, that's all for now. Are you are successful to add your custom post type form in the frontend of your WordPress site? If so, we hope that your audience will get some awesome frontend user experience.

However, within custom post types in hand, there are a handful of more usabilities of WP User Frontend to give your customers, readers or visitors some excellent experience. You may like to try them anytime.

If you have any queries or recommendations feel free to ask us in the comments section.. We will love to reply as soon as possible.

Adrita
Written by

Adrita

Adrita is a WordPress Blogger & Digital Marketer. Enthusiastic about producing content on challenging subjects. Besides, she loves to sing classical songs, watch movies, travel and read love stories. Apart from all of these, she fancies playing with her pet dog “Judy” & "Deany".

Have something to say? Cancel Reply

Your email address will not be published.

Table of Contents