In this article, we are going to review adding Ticket and RSVP blocks to a custom post type in the WordPress Block Editor.

Prerequisites

👋 You will want to make sure that the Block Editor is enabled on your site before proceeding. If you see the classic WordPress editor instead of the block editor, then check that there are no plugins active that are disabling it.

What is a custom post type?

WordPress, by default, provides “Posts” that we can use to publish blog posts. Some sites use them just for that: blog posts. But sometimes you need more than one post type to publish multiple types of posts.

A good example of that actually comes from The Events Calendar because “Events” are a custom post type. They access the WordPress editor and offer a set of additional post fields that are specific to events and not regular posts. That way, events and blog posts have their own set of fields and they can be managed independently of ones another.

Creating a custom post type

Custom post types can be created by registering them with the register_post_type function. See the WordPress Developer Handbook for full documentation.

But if you prefer to create a custom post type without touch code, you might want to check out the Custom Post Type UI plugin by WebDevStudios. It allows you to create any number of custom post types directly from the WordPress admin.

Enabling Tickets and RSVPs on a custom post type

Once your custom post type is configured, create a new post of that post type in the WordPress admin. For example, if your post type is called “Portfolio” then you might see an item in the WordPress admin menu with that same name, along with an option under it create a new Portfolio post.

The first thing is to make sure that the Event Tickets plugin is configured to work with your custom post type. Event Tickets allows you to specify exactly which post types should be able to use tickets and RSVPs.

Navigate to TicketsSettingsGeneral from the WordPress dashboard. There is an option to enable tickets and RSVPs for specific post types.

Select the post type
In this example, the “Event” post type has enabled tickets and RSVPs. Be sure to save your settings before leaving the page.

The next step is to check that the custom post type supports custom fields for posts. Custom post types do not support them right out of the box, so that is something we need to enable.

If you have registered your custom post type with a function, then custom fields can be enabled using the $supports argument:

'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields' ),

However, if you’re using the Custom Post Type UI plugin, then navigate to CPT UIAdd/Edit Post TypeEdit Post Types from the WordPress dashboard. Select the custom post type your created from the Select drop down menu, then scroll down to the “Supports” section of the page.

Select the “Custom Fields” option and save your settings.

Adding Ticket and RSVP blocks to a post

Now that everything has been configured, the Ticket and RSVP blocks are available in the WordPress block inserter, allowing you to add tickets and RSVPs to your custom post in the WordPress Block Editor.