For the complete documentation index, see llms.txt. This page is also available as Markdown.

Custom post types

acpt/list-post-types, acpt/get-post-type, acpt/save-post-type, acpt/delete-post-type

Category: acpt-content-model · Default capability: manage_options

Ability
What it does

acpt/list-post-types

Returns every custom post type registered via ACPT

acpt/get-post-type

Returns a single custom post type by slug

acpt/save-post-type

Creates a post type, or updates it if the slug already exists

acpt/delete-post-type

Deletes a post type definition

acpt/list-post-types

No input required.

$result = wp_get_ability('acpt/list-post-types')->execute();

// $result['data'] is an array of post type objects, shaped like the
// acpt/get-post-type example below.

acpt/get-post-type

Input

Property
Type
Required
Description

post_type

string

Yes

The post type technical name (post_name)

$result = wp_get_ability('acpt/get-post-type')->execute([
    'post_type' => 'movie',
]);

If post_type doesn't match an existing ACPT post type, the ability returns a WP_Error with code acpt_ability_failed.

acpt/save-post-type

Input

Property
Type
Required
Notes

post_name

string

Yes

Max 20 characters. If a post type with this slug already exists, it's updated instead of duplicated

singular_label

string

Yes

plural_label

string

Yes

icon

string

No

Any Dashicon slug, e.g. admin-post. Defaults to admin-post if omitted

supports

array<string>

No

title, editor, thumbnail, excerpt, author, trackbacks, custom-fields, comments, revisions, page-attributes, post-formats. Defaults to ["title", "editor"] if omitted

labels

object

No

Any subset of WordPress's post type labels (menu_name, add_new, edit_item, …). Defaults to a full set derived from singular_label/plural_label if omitted — see below

settings

object

No

Any subset of register_post_type()'s arguments — public, show_in_menu, show_in_rest, has_archive, rewrite, menu_position, capability_type, etc. Defaults to a full, working set if omitted — see below

The response data is the same shape as acpt/get-post-type's.

Defaults when fields are omitted

icon, supports, labels, and settings are all optional. Omitting one of them entirely fills it in with the same values the admin UI's creation wizard pre-selects for a brand-new post type — the result behaves identically to one created through the UI without touching any toggle. This is different from sending an explicit empty value: "supports": []/"labels": {}/"settings": {} is respected as-is (a deliberately bare post type), while leaving the key out entirely gets the defaults below.

Field
Default when omitted

icon

admin-post

supports

["title", "editor"]

labels

Derived from singular_label/plural_label — add_new_item: "Add new {singular}", edit_item: "Edit {singular}", not_found: "No {singular} found", etc. (every label WordPress's register_post_type() accepts)

settings

public: true, publicly_queryable: true, show_ui: true, show_in_menu: true, show_in_nav_menus: true, show_in_admin_bar: true, show_in_rest: true, capability_type: "post", has_archive: "<post_name>" (the post type's own slug), rewrite: true, query_var: true

Sending a partial labels/settings object (some keys, not all) does not trigger these defaults for the missing keys — only a fully omitted field does. Whatever you send for labels/settings is used as-is.

acpt/delete-post-type

Input

Property
Type
Required
Description

post_type

string

Yes

The post type slug to delete

delete_posts

boolean

No

true also deletes every post of that type. Defaults to false

Last updated