Main Website

How to create custom post types in WordPress?

WordPress enables you to natively create two content types: posts and pages. Posts are apt for blog content while pages suit static resources like about us, privacy policy, and so on.

Additionally, WordPress enables you to create other types of custom post types or CPTs. Custom post types enable you to create content types besides posts and pages.

Let’s take the ability to create products with WooCommerce. By installing WooCommerce, you can create a new content type called products.

Similarly, you create custom post types in WordPress on your own and go beyond native posts and pages.

You can create custom posts types with a plugin, or do it manually. The following sections explain both options in detail.

Creating custom post types in WordPress with a plugin: A step-by-step guide

It is recommended that you use a plugin to create custom post types if you’re not familiar with the technical side of WordPress.

For convenience, let’s assume that we wish to create real estate listings on a WordPress website. Since real estate listings don’t exactly match with posts and pages, we’re going to create a new custom post type.

Step 1: Install and activate the Custom Post Type UI plugin

Custom Post Type UI (CPT UI) is a simple interface that allows you to create and manage custom posts and taxonomies.

This is a reliable plugin with over one million active installations. Since we’re creating real estate listings, we can use CPT UI to create a new custom post type and display it on the website.

Once the plugin is activated, you will see the CPT UI button in the left panel menu. Now proceed to the next steps.

Step 2: Create a new custom post type

After activating the plugin, navigate to CPT UI > Add/Edit Post Types from the left panel menu. Here’s what you need to do next:

Enter the slug of your new type of post. The slug you enter will be part of the URLs which are generated when that CPT is created. Let’s enter property-listing here. This means each new property listing created would have the following URL format:

Enter the plural label. Just as the plural for a post on WordPress is Posts, you can enter Property Listings here.

You can similarly enter the singular label as Property Listing.

Click on Populate Additional Labels based on chosen labels. The labels associated with the new post types will be populated below. For instance, instead of Add Post, you will see Add Property Listing and so on. If there’s a label you’d like to change, you can do that as well.

Step 3: Configure custom post type settings

You will see the Settings section as you scroll down. Here you can manage various settings related to your new type of custom post.

Some of the more crucial settings have been discussed in the following points:

  • Public: You can choose whether to make the new CPT public. If you choose to do so, it would be publicly visible and searchable.
  • Show UI: This option creates an entry in your WordPress left menu where you can manage the new post type. It is advised that you let this remain True.
  • Show in Nav Menu: Select True if you want the ability to add the new CPT to your website menus.
  • Hierarchical: Select True if you want to make sure that the new CPT doesn’t appear like posts in reverse chronological order. Choose False if you’d like recently created real estate listings to always appear first.
  • Supports: You can select which attributes you’d like to add to the new CPT. For instance, posts enable you to add a title, featured image, author, excerpt, comments, and so on.

Step 4: Select taxonomies

Taxonomies and post types are very closely related. We can define taxonomies in the context of WordPress as a way to cluster content types together.

For instance, you can group together multiple posts to create Categories, a native WordPress taxonomy. Similarly, if you’re creating a custom post type called Chapters, a relevant taxonomy for a collection of chapters would be Books.

Read: An introduction to WordPress taxonomies

You can choose a taxonomy for your new CPT. On the same page, you will see a list of existing taxonomies which you can select for property listings.

If you can’t associate a relevant taxonomy with the post type, you can leave this field unchecked. You can alternatively create a new taxonomy first and then select it for your new CPT.

Once all your settings are configured, click on Add Post Type. You will see a new button in your left menu called My Property Listings. You can add new listings from here.

Creating custom post types in WordPress without a plugin

If you’re comfortable adding custom code to your website, you can create custom post types without using a plugin.

Using a plugin to create CPTs has its own drawbacks. If you deactivate the plugin, your custom post types will go away as well. It is also good to know how WordPress works on a granular level.

  • Navigate to Appearance > Theme Editor in your WordPress Admin Panel.
  • On the right, click on the functions.php file.
  • Copy the contents of the file and save it separately in a Notepad file as a backup.
  • Scroll down to the last line of the file. After the line, enter the following code:
function create_posttype() {
      register_post_type( 'movies',
    // CPT Options
             'labels' => array(
              'name' => __( 'Property Listings' ),
                  'singular_name' => __( 'Property Listing' )
            'public' => true,
        'has_archive' => true,
              'rewrite' => array('slug' => 'property-listing'),
'show_in_rest' => true,
// Hooking up our function to theme setup
add_action( 'init', 'create_posttype' );

You can refer to official WordPress documentation to learn more about registering new custom post types.

In the code, you find Property Listing as the name of the custom post type. You can replace this with your own CPT name. Also, remember to change the slug. Within the same code, you can add labels for other fields as well.

Showing custom post types in your WordPress website

Now that you’ve created custom posts on your WordPress website, it’s time to see how you can display them on your website.

Showing posts, pages, and categories on your website is fairly simple. This is because WordPress is built to make it easy for users to display native post types and taxonomies.

Let’s see how you can manage the display of your CPTs.

#1: Show custom posts in navigation menus

Once you create a custom post type, you will see it listed amongst the item options on the Menu screen.

As you keep adding new posts as CPTs, you would be able to add them to any menu on your website. To show an archive of all posts in a particular CPT, you can select the Custom Links option and enter the archive link.

Since the slug we’ve used in this article for the real estate listing CPT is property-listing, the archive link should be

WordPress enables you to populate your website’s sidebar and footer with widgets. WordPress comes loaded with some native widgets and as you plugins to your website, you’ll start seeing more options.

While WordPress enables you to show posts, pages, and categories through widgets, there’s no option to show CPTs. You can access CPT widgets with the Ultimate Posts Widgets plugin.

This plugin enables you to show custom posts with widgets.  

Sync custom post types to your app with AppMySite

Let’s assume you wish to make free apps with an app maker like AppMySite. You may know that AppMySite easily syncs native posts and pages from your website to app.

What about custom post types? Is there a way to sync CPTs to your mobile app as well?

AppMySite provides support for custom post types and taxonomies. If you’ve created CPTs on your website, you can seamlessly sync them to your app.

This support is not restricted to CPTs created with CPT UI alone. Other plugins also create custom post types on a website. Tutor LMS for example enables website owners to create course post types and taxonomies.

Read: How to make an app for your course-based WordPress website?

CPTs created with any third-party plugin can be synced with your mobile app. All you need to do is add CPTs to a website menu and then sync the same menu to the app. You will see that your CPTs will start appearing in the side menu of the app.

Whether it’s real estate mobile application development or building restaurant apps, AppMySite is the right solution for your business.

In conclusion

WordPress is a great platform to create a website, but it’s powerful enough in its native form. This is where using plugins can help you make powerful websites that are well-organized and adaptable to different use-cases.

With plugins powerful enough to help you create a mobile app, there’s no limit to the number of ways you can leverage your WordPress site.

You can look beyond posts and pages with custom post types and introduce new types of content to your site.


Related Articles