Custom Post Type Builder – Create Post Types, Taxonomies & Custom Fields Without Code
Create WordPress custom post types, custom taxonomies, and custom fields without code. Block editor and REST API ready, with PHP code export and JSON import/export.
Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/bealinawaz/custom-post-type-builder/archive/refs/heads/master.zipCreate custom post types, custom taxonomies, and custom fields from the WordPress dashboard, with no code. Every post type works with the block editor and the REST API, and a "Get PHP code" button shows the equivalent register_post_type(), register_taxonomy(), and register_post_meta() code, ready to copy into a theme or plugin.
Formerly Custom Post Type Generator 1.0. Version 2.0 is a complete rewrite; post types created with 1.0 are converted automatically and keep their content.
Features
- Custom post types from a plural and singular name, with the complete label set generated for you.
- Key validation against WordPress reserved names, existing post types and taxonomies, and the 20 and 32 character limits.
- Settings: URL slug, description, public, REST API and block editor, archive, hierarchical, exclude from search, post or page capabilities, menu position, searchable dashicon picker, supports (title, editor, author, featured image, excerpt, trackbacks, custom fields, comments, revisions, page attributes, post formats), and the built-in categories and tags.
- Custom taxonomies: category-like or tag-like, attached to any post type, including Posts, Pages, and WooCommerce products, with REST API and admin column options.
- Custom fields: text, text area, number, email, URL, date, select, checkbox, and image (media library). Shown in a meta box on the edit screen and registered with
register_post_meta()(show_in_rest, type-specific sanitizing,edit_postauth). [cptb_field name="key"]shortcode to show a field value on the site.- Get PHP code for each post type and taxonomy, or everything at once.
- JSON import and export of all definitions.
- Rewrite rules are flushed once after every change.
- Content is never deleted: deactivating or uninstalling removes only the plugin's settings.
Usage
- Install and activate the plugin.
- Go to Post Types → Add Post Type, enter
BooksandBook, and save. - Add custom fields on the same screen, then create a taxonomy under Post Types → Add Taxonomy.
- Use Get PHP code to move a post type into your theme, or Import / Export to copy definitions to another site.
Read field values with get_post_meta( get_the_ID(), 'price', true ), the shortcode, or the meta property of the REST API (/wp-json/wp/v2/{post_type}).
Hooks
// Change the arguments of a post type created with the plugin.
add_filter( 'cptb_post_type_args', function ( $args, $definition ) {
if ( 'book' === $definition['key'] ) {
$args['show_in_graphql'] = true;
}
return $args;
}, 10, 2 );
// Same for taxonomies.
add_filter( 'cptb_taxonomy_args', function ( $args, $definition ) {
return $args;
}, 10, 2 );
Storage
Definitions are stored in the cptb_post_types and cptb_taxonomies options. Field values are ordinary post meta under the field key.
Project structure
custom-post-type-builder.php Plugin header and bootstrap
includes/class-cptb-store.php Definitions, defaults, sanitizing, and key validation
includes/class-cptb-register.php register_post_type() and register_taxonomy(), labels, rewrite flush
includes/class-cptb-fields.php register_post_meta(), edit screen meta box, [cptb_field] shortcode
includes/class-cptb-code.php PHP code generator
includes/class-cptb-admin.php Admin menu, list and edit screens, import and export
includes/class-cptb-migration.php Upgrade from Custom Post Type Generator 1.0
assets/ Admin and meta box styles and scripts
uninstall.php Removes the plugin's options (never content)
readme.txt WordPress.org readme
Custom development
Need templates for your post types, front-end submission forms, a directory or listing site, or advanced fields? The plugin is built and maintained by Ali Nawaz, a WordPress and WooCommerce developer. Get in touch for custom work.
License
GPLv2 or later. See LICENSE.