What is a custom post type (CPT)? (2024)

CPT stands for Custom Post Type. WordPress uses posts as a way of storing various pieces of content. This content can then be used in lots of different ways. Even though they are referred to as posts, they can be used for anything that requires content to be stored, changed and removed. WordPress uses multiple post types for some basic functionality.

By default you have WordPress posts and these form the basis of any WordPress blog. WordPress also uses built-in post types to manage menus, attachments, revisions and pages.

So what is a custom post type?

Custom post types are specific post types that have been added to WordPress using custom code or plugins. The idea is that you may want to add additional functionality to your site but don’t want to add everything as a standard post.

Imagine you would like to add in a section to your website for your team members. You could build a custom page for this but then you would need to edit that page to add or remove any new team members. This can become difficult to manage and time-consuming. By creating a custom post type instead, you create an interface for adding new team members that are automatically inserted into a template designed for that content.

Custom post types are great because they give developers and site managers a way of adding new functionality and content without having to handle complex coding every time.

Illustrate Digital’s Global Page Speed Report 2024

Read it here!

Custom Posts

The basic part of any custom post type is the post itself. When you create your Team post type you will get a new menu item, just like Posts, Media and Pages. This makes it easy to see the content of your teams separately.

From there you can add, edit and remove any team members easily from a familiar admin interface.

It is really useful to create a new post type but on its own you could only add a title, text and very little else. Let’s take a look at some of the tools available to enhance a custom post type and make it easily customisable for any purpose.

Taxonomies

Taxonomies give you a way of grouping content. The categories and tags on a standard WordPress Post are different types of taxonomies. The actual categories and tags are called terms.

By using taxonomies or creating new ones you can start to enhance your post type and make grouping content very easy. If you team had various departments or skills you could add those as taxonomies. That way, when you assign them to each member in the post type you would be able to pull that information out and use it in your site and theme in various ways.

Custom fields

Custom fields are another great way to enhance any post type or custom post type. A custom field allows you to add virtually any additional information you would like. A standard field would be the title or the description of a post or page. These are stored separately in your site so they can be easily used at a later point in your theme.

If you wanted to enhance your Team post type with additional information such as a person’s job title or qualifications then you could create a custom field for this.

Custom fields can be added to all post types and custom post types. There are various tools and plugins available to help add custom fields to your WordPress site. Many of these tools like Advanced Custom Fields make it easy to create custom fields without using any code until you want to display it on your site.

Theming and plugins

Custom post types are vital when it comes to theme customisation. Very often themes will add additional post types to power the various custom parts of the theme. Not only can the theme add custom post types but they can also be added with plugins.

Sometimes plugins that create custom post types are a better option in the long run. If your Team post type was added to the theme and you decided to change the theme later, than you would lose it. The benefit of a plugin is that you can leave the plugin in place and still change the theme so you don’t lose that functionality.

Ready to unlock the power of WordPress for your website?

Contact us!

What is a custom post type (CPT)? (2024)

FAQs

What is a custom post type (CPT)? ›

Custom post types are specific post types that have been added to WordPress using custom code or plugins. The idea is that you may want to add additional functionality to your site but don't want to add everything as a standard post.

What is the difference between post type and custom post type? ›

A custom post type is nothing more than a regular post with a different post_type value in the database. The post type of regular posts is post , pages use page , attachments use attachment and so on. You can now create your own to indicate the type of content created.

What are custom post types in WordPress and how would you use them in a real world scenario? ›

However, a post can relate to any kind of content and you can create your own post types with different custom fields and characteristics and call them whatever you want. For example, if you create a website that hosts your professional portfolio you may want to create a new custom “Portfolio Item” post type.

What is the post type in WordPress? ›

Post types are ways of categorizing different types of content in WordPress. I'm assuming you're already familiar with the two most common post types: posts and pages. But what you might not know is that WordPress also comes bundled with a few other post types.

What is a custom post type CPT? ›

Custom post types are specific post types that have been added to WordPress using custom code or plugins. The idea is that you may want to add additional functionality to your site but don't want to add everything as a standard post. Imagine you would like to add in a section to your website for your team members.

When to use custom post type? ›

We use these custom post types to better organize your content into different areas instead of adding all the above into the default custom post type “pages”. There are other cases where we will create specific custom post types to meet the needs of our clients.

Can I assign a template to a custom post type? ›

You can create a custom WordPress template for a page, post, or custom post type and make it appear in the Template dropdown list on page, post, or custom post type editing screens.

How do I edit a custom post type? ›

Go to Posts and open any piece of content, or add a new one. The post type converter is located on the right side of the WordPress editor under the “Publish” section. Click the “Edit” link next to Post Type. Use the drop down box to change the post type.

How do I convert a post to a custom post type in WordPress? ›

Go to the WordPress editor of the desired post/page and open the Summary tab on the right side of the page. Find the Post Type field and press the link next to it to change the post type. Pick the post type you want to switch your content to; for example, it can be JetEngine's CPT.

How do I fetch a custom post type in WordPress? ›

How to Use WP_Query to Display Custom Post Type
  1. Set up a variable that contains an array of parameters you'll pass to the WP_Query class. ...
  2. Set the parameter 'post_status' to 'published' which will ensure the requested posts are published and not in a 'draft' state.

How do I see all custom post types in WordPress? ›

The easiest way to list WordPress search custom post types is by using a plugin. This way, you don't have to mess around with code snippets like register_post_type , pre_get_posts , add_filter , add_action , or wp_query in your functions. php file or template files or hire a WordPress developer.

How do you check if a page is a post type in WordPress? ›

You can use the is_page() and is_single() functions. You can also use get_post_type() function. If you're looping through a collection of posts/pages (say, on a search results page), then is_single() and is_page() won't be of any use.

Why do we use post in WordPress? ›

A post (or article) is one of the two types of content available by default in WordPress, the second being the page (see the page definition). Posts are used for publications related to a given date, event or theme. They are mainly used in blogs and news sites.

What is the difference between a default generic WordPress post and a custom post type? ›

Pages and posts are your default content types, but WordPress custom post types allows you to create more different types of content, that can be used for different purposes.

What is the difference between taxonomy and custom post type? ›

Post types are the way to differentiate content types in WordPress. For instance, pages and navigation menus are both post types however, they are made to serve different purpose. Taxonomy is used to group post and custom post types together. The default WordPress taxonomy are categories and tags.

What is a customs post? ›

customs post (plural customs posts) A place at a border crossing or port of entry where customs and passport checks are carried out.

When to use custom taxonomy? ›

How Do You Know When You Need a Custom Post Type or Taxonomy?
  1. Some content you are posting just doesn't look and feel like a post. ...
  2. Your content doesn't need to be part of a chronological series of entries. ...
  3. Categories and tags won't help you group and sort that particular content.
Jan 22, 2024

Top Articles
Latest Posts
Article information

Author: Wyatt Volkman LLD

Last Updated:

Views: 6256

Rating: 4.6 / 5 (46 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Wyatt Volkman LLD

Birthday: 1992-02-16

Address: Suite 851 78549 Lubowitz Well, Wardside, TX 98080-8615

Phone: +67618977178100

Job: Manufacturing Director

Hobby: Running, Mountaineering, Inline skating, Writing, Baton twirling, Computer programming, Stone skipping

Introduction: My name is Wyatt Volkman LLD, I am a handsome, rich, comfortable, lively, zealous, graceful, gifted person who loves writing and wants to share my knowledge and understanding with you.