- Function generator for WordPress developers
- WordPress Custom Post Type Generator Tool
- Last updated: December 17, 2024
- View tool
This is a very simple tool to make it very easy and fast to generate the WordPress code needed to create your own Custom Post Types (CPTs) using WordPress’ register_post_type()
function.
Unlike other tools, this one will attempt to autofill the labels for you based on the Singular and Plural names you enter. You can also use this tool to enable the Rest API/Gutenberg for your Custom Post Types as well. Pretty cool!
How to add Custom Post Types in WordPress
Custom Post Types can be used with WordPress to accomplish many cool things, and I personally use them all the time. I use CPTs in HD Quiz for questions, HDForms for forms, and HDInvoice for invoices. Even this site uses CPTs a lot. Product, order, and support threads, were all built by using Custom Post Types!
Main
This is the key/slug that the post type will be registered as
Examples: Product, Book, Event, etc
Examples: Products, Books, Events, etc
Short description of what this CPT is used for
Comma separated list of taxonomies to attach this CPT to.
If CPT items can have a parent => child relationship (like with posts), or not (like with pages).
Only enable this if you also have Editor enabled under Supported Features
Labels
NOTE: These will update whenever you change the Singular or Plural names on the Main tab.
Visibility
If items in this CPT should appear in search results.
If enabled, WordPress will use this CPT slug as the archive.
If this CPT can be exported using WordPress’ export tool.
If this CPT is intended for use publicly, either via the admin interface or by front-end users.
If this CPT create default pages (like Posts and Pages). Set to “No” if you don’t need those admin pages.
Allow items of this CPT to be added to a menu.
Accepts whole integers. 5
is below Posts. 20
is below Pages. 80
is below Settings.
Accepts either a dashicon ID, or a full URL to an image.
If this CPT should show a menu item in the top admin bar for logged in users.
Code
You need to select “Generate Code” in order to populate/update this.
Please note that these tools are intended as helpers for professional WordPress developers.
Use of any code provided here is at your own risk.