In this article, you will learn about How to create Custom Post Type and Custom Taxonomy in WordPress Here we will create Custom Post Type and Custom Taxonomy using the “Post Types” WordPress plugin.
You can write code for create custom post or taxonomy in your themes function.php file or you can create child theme for the same. to learn how to create child theme you can go through our blog post
What is a Custom Post Type?
Custom post types are specific post types that are added to WordPress using custom code or plugins. It is used to add specific additional functionality to your site.
What is Custom Taxonomy?
Custom Taxonomy is one kind of category created by the user itself using custom code or plugins. It is used to organize groups of posts and custom post types.
Now, Let’s learn about how to create Custom Post Type and Custom Taxonomy step by step.
Steps to create Custom Post Type
Step 1: Install Post Types WordPress plugin : https://wordpress.org/plugins/custom-post-type-ui/
Step 2: Go to Post Types from the left sidebar menu it will open custom post type maker page on this page click on the “Add New” button
Step 3: On add new page you can add the details about the Custom Post Type you are going to create.
- Custom Post Type Name
- Label
- Singular Name
- Description
- Public
- Custom Rewrite Slug
- Icon
- Capability Type
- Hierarchical
- Supports
- Built-in Taxonomies
Other than this there are many fields you can change as per your requirements.
Step 4: Click on Publish
Now, we can see our newly created Custom Post Type. now we can create our new post using it.
Steps to create Custom Taxonomy
Step 1: Go to Taxonomies from the right side menu and click on the “Add New” button
Step 2: Enter all the details about Custom Taxonomy you are going to create
- Add title
- Custom Taxonomy Name
- Label
- Singular Name
- Show UI
- Hierarchical
- Rewrite
- Custom Rewrite Slug
- Query Var
- Show in REST
- Admin Column
- Post Types
Step 3: Select Post Type (Which we have created)
Step 4: Click on Publish
Now, we can see our newly created Custom Taxonomy.
And now you can add a new category within your newly created taxonomy. like this,
Here we can also add custom post type and taxonomy into your posts.
Conclusion
Custom post types are just like our regular posts except that they can have any kind of content. and as it is, custom taxonomy is like a simple category that organizes a group of posts and custom post types.
in the next article, we will learn about creating custom post types and taxonomy manually.