Nexym
  • Business
  • Finance
  • Technology
  • Health
  • Life
  • More
    • Auto
    • Food
    • Health
    • Home
    • Space
    • Travel

Subscribe to Updates

Get the latest creative news from FooBar about art, design and business.

What's Hot
Flywheel Logo

Flywheel review in 2023

June 8, 2023
Mutual funds are a popular way to invest in today's stock market. Learn what mutual funds are and how they work, as well as their benefits and drawbacks.

What are mutual funds and how to use them

October 1, 2023
Learn more about Daylight Saving Time (DST), why it exists, how we came up with this idea, and why some countries don't follow DST.

Daylight Saving Time: How did we start changing clock

September 30, 2023
Facebook X (Twitter) Instagram
Nexym
  • Business
    Learn more about Daylight Saving Time (DST), why it exists, how we came up with this idea, and why some countries don't follow DST.

    Daylight Saving Time: How did we start changing clock

    September 30, 2023
    protectteamabusivecustomers featureimage min

    How to protect your team from an abusive customer

    September 7, 2023
    Learn the skills you need to become a great content writer. From writing, editing, and researching to storytelling and creative thinking.

    Top skills you need to become a great content writer

    August 20, 2023
    featured business

    How to see the bigger picture in business

    August 9, 2023
    What is a corporation? What does it mean to be incorporated? How do you start one? Read the definition of corporation, learn the different types of corporations and how to incorporate them.

    What is a corporation? Definition, meaning, types and more

    August 8, 2023
  • Finance
    Mutual funds are a popular way to invest in today's stock market. Learn what mutual funds are and how they work, as well as their benefits and drawbacks.

    What are mutual funds and how to use them

    October 1, 2023
    Find out more about the tax implications of your retirement income based on your yearly taxable earnings.

    Do you pay taxes as a retiree if you earn extra money?

    September 9, 2023
    Learn areas to reduce or eliminate your tax obligation when you receive a settlement.

    How to decrease or eliminate your tax burden on lawsuit settlements

    September 8, 2023
    Learn about the IRS TREAS 310 deposit refund from Social Security and how it relates to your tax return.

    What is a Social Security IRS TREAS 310 deposit?

    September 8, 2023
    Find out what's holding up the tax return process and how you can get access to your money faster.

    Learn why your tax return money is delayed

    September 3, 2023
  • Technology
    Flywheel Logo

    Flywheel review in 2023

    June 8, 2023
    Find out how the Xbox Series S compares to more advanced alternatives! We'll tell you everything you need to know, including specs and features.

    How Xbox Series S compares to more advanced alternatives

    September 9, 2023
    How to embed Tik Tok

    How to embed TikTok videos into your WordPress website

    September 7, 2023
    reviewsitewp featureimage min

    How to build a review site in WordPress

    September 7, 2023
    Choosing color scheme for your website

    How to choose the perfect color scheme for your WordPress website

    September 7, 2023
  • Health
  • Life
    Find out which New Balance running shoes are best for your foot type, and how to match them with the other features you're looking for in a shoe.

    5 of the best New Balance running shoes for each foot type and need

    September 9, 2023
    If you're looking for a stylish and comfortable athletic swimsuit fitted for large breasts, check out our list of the top 10 athletic swimsuits.

    The 10 best athletic swimsuits for larger chests

    September 4, 2023
    Learn about the recent rate hikes by Verizon and AT&T, what this means for consumers and how to keep your cell phone bill in check.

    Inflation has finally caught up with cell phone bills – Verizon and AT&T new increased rates

    September 3, 2023
    Spring is almost here, and Walmart has got you covered with the latest trends! Check out these fabulous finds that won't break the bank!

    Surprise! Walmart has awesome spring fashion items

    August 28, 2023
    Find the perfect birthday messages and quotes for a special friend. Share them with your best friend on their birthday!

    28 creative birthday wishes for your best friend

    August 26, 2023
  • More
    • Auto
    • Food
    • Health
    • Home
    • Space
    • Travel
Facebook X (Twitter) Instagram
Trending
  • Flywheel review in 2023
  • What are mutual funds and how to use them
  • Daylight Saving Time: How did we start changing clock
  • Is life insurance with no medical exam viable for healthy people?
  • Why Ford’s electric F-150 Lightning is excellent for road trips
  • The best outdoor chairs you can find on Amazon
  • Check out these discounts for 7 all-inclusive Caribbean resorts
  • Here are the best shoes for travel and airports
Nexym
Home » Technology » WordPress
WordPress

How to create custom post types in WordPress

Matthew DrummondBy Matthew DrummondMay 16, 20236 Mins Read
Facebook Twitter LinkedIn Reddit Telegram WhatsApp Pinterest Email
Learn how to add custom post types to your WordPress website with this easy step-by-step guide.
How to create custom post types.
Share
Facebook Twitter LinkedIn

Custom post types enable you to create unique types of content for your website beyond posts and pages. They convert your WordPress blog into a robust content management system (CMS).

This article will show you how to create unique post types in WordPress.

What are custom post types?

Post types are used to differentiate between different types of content on your WordPress website. Pages and posts are both types of posts, but they fulfill specific responsibilities.

WordPress includes the following post types by default:

  • Navigation Menu
  • Page
  • Post
  • Revision
  • Attachment

Custom post types allow you to create your own post types. These are helpful when creating content that does not follow the standard post or page format.

For example, if you run a website dedicated to music album reviews, you would likely choose to create a post type for album reviews. You could also create custom post types for testimonials, portfolios, and products.

You can add different custom fields and a unique category structure to custom post types.

Numerous popular WordPress plugins utilize custom post types to store and manage data on your WordPress website.

Before adding custom post types to your WordPress website, it’s important to consider your requirements.

How to create a custom post type in WordPress

Using a plugin

Using the plugin is the simplest way of creating a custom post type in WordPress. This technique is best for beginners because it’s straightforward and simple.

The first step is to install and activate the Custom Post Type UI plugin:

Learn how to add custom post types to your WordPress website with this easy step-by-step guide.
Custom Post Type UI plugin

Head to Plugins > Add New in your WordPress dashboard, search for Custom Post Type UI plugin in the top-right search bar and click Install Now:

Learn how to add custom post types to your WordPress website with this easy step-by-step guide.
Install the plugin

Once installed, click Activate to activate the plugin:

Learn how to add custom post types to your WordPress website with this easy step-by-step guide.
Activate the plugin

After activation, you must navigate to CPT UI > Add/Edit Post Types to create a new custom post type. You need to be on the ‘Add New Post Type‘ tab to do this.

Learn how to add custom post types to your WordPress website with this easy step-by-step guide.
Head to plugin’s settings

You must first provide a slug for your custom post type, such as music. The system will use this slug in the URL and WordPress requests, so it can only be made up of letters and numbers. Then, you specify your custom post type’s plural and singular names.

Then, if you want, you can click the link that reads “Populate additional labels based on selected labels.” This will save you time by automatically populating the extra label fields below.

Learn how to add custom post types to your WordPress website with this easy step-by-step guide.
Configure plugin settings

Scroll down to the ‘Additional Labels’ section now. If you did not click the automatic feature mentioned before – you should now provide a post-type description and modify labels.

Configure additional settings
Configure additional settings

These labels will appear throughout the WordPress user interface when you’re managing content in that particular post type.

The post-type settings come next. Here, you can configure various attributes for your post type, and each option includes a brief explanation of its function.

Learn how to add custom post types to your WordPress website with this easy step-by-step guide.
Configure post type settings

For example, you can decide not to make a post type hierarchical like pages or sort posts in reverse order of when they were written.

Below the general settings, you can choose which editing features this post type will support. Tick off the options you want to include.

Learn how to add custom post types to your WordPress website with this easy step-by-step guide.
Configure editing features

To save and create your custom post type, click the Add Post Type button.

That’s it!

Creating a custom post type manually

If you ever deactivate your custom post types plugin, custom post types are lost, and your custom post type will become unregistered and inaccessible from the administration panel. This is why you might want to add your custom post type manually.

If you are working on a client’s site and do not want to install another plugin, you can manually create a custom post type by adding the code to your WordPress theme’s functions.php file or a site-specific plugin.

Here’s an easy code example:

// Our custom post type function

function create_posttype() {

    register_post_type( 'music',

    // CPT Options

        array(

            'labels' => array(

                'name' => __( 'Music' ),

                'singular_name' => __( 'Music' )

            ),

            'public' => true,

            'has_archive' => true,

            'rewrite' => array('slug' => 'music'),

            'show_in_rest' => true,

        )

    );

}

// Hooking up our function to theme setup

add_action( 'init', 'create_posttype' );

This code fragment registers the post-type music with an array of arguments. These are the options for our custom post type.

The array consists of two elements. The initial portion is labeled and is itself an array. The second section includes arguments such as public visibility, has archive, slug, and show in rest, which enable block editor support.

For a more detailed explanation, check WordPress’ official documentation.

How to display your custom post type on your WordPress website

WordPress includes support for displaying custom post types by default. Once you have added a few posts to your custom-made post type, it is time to show them on your website.

Navigate to Appearance > Menus to add a custom link to your menu. This is the link to your custom post type.

Learn how to add custom post types to your WordPress website with this easy step-by-step guide.
Displaying your custom post type

Your custom post type’s URL will most likely look like this if you are using SEO friendly permalinks:

https://example.com/music

If you are not using SEO-friendly permalinks, your custom post type URL will appear as follows:

https://example.com/?post type=music

Replace ‘example.com’ with your web domain and music with the name of your custom post type.

Visit the homepage of your website after saving the menu. When you click the newly added menu item, the archive page for your custom post type will be displayed using the archive.php template file from your theme.

People also viewed:

3bestwaysspeedwpwebsite featureimageThe 3 best ways to speed up your WordPress website howtosetupforumswp featureimageHow to set up forums on WordPress using the bbPress plugin disablewpcronspeedwp featureimageHow to speed up WordPress by disabling WP-cron clonewpwebsite featureimageHow to clone WordPress pages and posts howtofixfiletypesecurityreasonswperror featureimageHow to fix the “Sorry, this file type is not permitted for security reasons” WordPress error
custom post type custom post type in WordPress get custom post type in WordPress how to display custom post type in WordPress WordPress custom post type
Share. Facebook Twitter LinkedIn Reddit Telegram WhatsApp Pinterest Email
Previous ArticleThe ultimate guide to home equity loans
Next Article Best games for the Oculus Quest 2 in 2023
Matthew Drummond

Matthew is a Nexym Technology writer. Having worked as a systems administrator for over 15 years gives him unique insight into the inner works of technology. Ultimately his passion for writing brought him to share his technical expertise with the world.

Related Stories

3bestwaysspeedwpwebsite featureimage

The 3 best ways to speed up your WordPress website

September 7, 2023
clonewpwebsite featureimage

How to clone WordPress pages and posts

March 3, 2023
disablewpcronspeedwp featureimage

How to speed up WordPress by disabling WP-cron

May 17, 2023
howtosetupforumswp featureimage

How to set up forums on WordPress using the bbPress plugin

February 18, 2023

Comments are closed.

Connect
  • Facebook
  • Twitter
  • Pinterest
  • Instagram
  • YouTube
  • LinkedIn
  • Reddit
  • TikTok
Don't Miss
Flywheel Logo Reviews

Flywheel review in 2023

By Matthew Drummond

Flywheel is a fast-growing web host that offers high-performance WordPress hosting for agencies, designers, and developers.

Mutual funds are a popular way to invest in today's stock market. Learn what mutual funds are and how they work, as well as their benefits and drawbacks.

What are mutual funds and how to use them

October 1, 2023
Learn more about Daylight Saving Time (DST), why it exists, how we came up with this idea, and why some countries don't follow DST.

Daylight Saving Time: How did we start changing clock

September 30, 2023
Learn about the benefits of getting life insurance without a medical exam and determine if it's the right choice.

Is life insurance with no medical exam viable for healthy people?

September 29, 2023
  • Auto
    • Auto Reviews
    • Electric
    • Insurance
  • Business
    • Company
    • Government
  • Entertainment
    • Movies
    • Music
  • Finance
    • Credit Cards
    • Crypto
    • Market
    • Personal Finance
  • Food
    • Coffee
    • Drinks
    • Holidays
  • Health
  • Beauty
  • Fitness
  • Food
  • Medical
  • Home
  • Backyard
  • Bathroom
  • Bedroom
  • Cleaning
  • Furniture
  • Home Office
  • Kitchen
  • Life
  • Astrology
  • Family
  • Fashion
  • Outdoors
  • Personal
  • Pets
  • Apple
  • Audio
  • Domain Names
  • Gaming
  • Google
  • Power
  • Reviews
  • Samsung
  • Destinations
  • Gear
  • Services
  • Space
  • Tourism
  • Technology
  • Tutorials
  • Web Hosting
  • WiFi
  • WordPress
  • Travel
  • Shopping
  • Sports
  • Work
  • Stocks
  • Television
  • Web Hosting
Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn Reddit TikTok
© 2023 Nexym Media

Type above and press Enter to search. Press Esc to cancel.