Custom Post Type UI
New in 3.21.1 (free), and in EMCP Lite 1.0.5 on WordPress.org. Two dispatcher tools work with Custom Post Type UI 1.19.3:
| Tool | Default | Purpose |
|---|---|---|
cptui-read | On | CPT UI post types and taxonomies, and every public post type (6 operations) |
cptui-write | Off | Create post types and taxonomies, update labels and descriptions (4 operations) |
Enable the write tool under Tools > Plugins > Custom Post Type UI. Call a tool with no operation to get its operations and argument schemas.
Requirements
Section titled “Requirements”- Custom Post Type UI 1.19.3 exactly; another version answers
unsupported_version. - An administrator (
manage_options) who also has CPT UI’s required capability (manage_optionsunless a filter changes it).
Read operations
Section titled “Read operations”| Operation | What it does |
|---|---|
status | CPT UI version and the qualified version |
list-post-types | Post types stored by CPT UI, paged (page, per_page up to 100) |
list-taxonomies | Taxonomies stored by CPT UI, paged |
list-registered-post-types | Every public post type, with cptui_owned true or false |
get-post-type | One CPT UI post type by slug, with the version |
get-taxonomy | One CPT UI taxonomy by slug, with the version |
The version is a hash of every CPT UI post type and taxonomy together.
Write operations
Section titled “Write operations”Every write needs confirm: true; dry_run: true validates first. Updates need the current version.
| Operation | What it does |
|---|---|
create-post-type | slug, label, singular_label, optional description, public, show_in_rest, hierarchical and supports |
create-taxonomy | slug, label, singular_label, object_types (1 to 20 public post types), optional description, public, show_in_rest, hierarchical |
update-post-type | Change label, singular_label or description |
update-taxonomy | Change label, singular_label or description |
supports takes up to eight of title, editor, thumbnail, excerpt, revisions, author, comments and page-attributes. Set show_in_rest: true and include editor for the block editor. After each write the type is registered again and rewrite rules are refreshed.
Rules and refusals
Section titled “Rules and refusals”- Slugs are 2 to 20 characters, start with a lowercase letter and use
a-z,0-9and_. They never change after creation. - Reserved slugs from CPT UI’s own lists, the prefixes
wp_,emcp_,elementor,acf_and_, and any slug already registered are refused (protected_slug,already_exists). - Labels and descriptions must be plain text (
invalid_text). - No custom capability types, meta box callbacks, REST controllers, custom supports or default terms. A definition that carries them, or settings another extension stored, is refused (
unsupported_definition), because CPT UI’s own save would discard them. - When a filter replaces CPT UI’s stored definitions, writes and undo answer
filtered_storage; use the editor of the plugin that owns them. - Linked post types or taxonomies must exist and be public (
linked_unavailable). - There is no delete operation.
History
Section titled “History”Label and description updates can be undone from History. Undoing a creation removes the definition only when no posts of that type exist in any status, trash included, no terms exist in that taxonomy and no other definition refers to it. Otherwise it answers definition_in_use, even with force. If CPT UI fails after saving, EMCP restores the earlier definition or records a recovery entry.
