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

Dynamic blocks

acpt/list-blocks, acpt/get-block, acpt/save-block, acpt/delete-block

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

Ability
What it does

acpt/list-blocks

Returns every ACPT dynamic block

acpt/get-block

Returns a single block by name

acpt/save-block

Creates a block, or updates it if the name already exists

acpt/delete-block

Deletes a block

These abilities manage a block's definition (its controls, TWIG template, availability) — not the content of any specific block instance placed in a post. See Dynamic blocks → Introduction for the concepts and TWIG reference for templating.

acpt/list-blocks

No input required.

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

acpt/get-block

Input

Property
Type
Required

name

string

Yes

$result = wp_get_ability('acpt/get-block')->execute([
    'name' => 'movie-hero',
]);
{
  "success": true,
  "message": "Operation completed successfully.",
  "data": {
    "id": "a6b7c8d9-0123-4abc-9def-0123456789ab",
    "name": "movie-hero",
    "title": "Movie Hero",
    "category": "acpt",
    "icon": "cover-image",
    "css": null,
    "callback": null,
    "keywords": ["movie", "hero"],
    "postTypes": ["movie"],
    "controls": [
      {
        "id": "b7c8d9e0-1234-4abc-9def-0123456789ab",
        "name": "overlay_opacity",
        "label": "Overlay opacity",
        "type": "Range",
        "default": "50",
        "settings": {}
      }
    ],
    "scriptName": "movie_hero_block_js",
    "blockName": "acpt-dynamic-blocks/movie-hero",
    "supports": []
  }
}

icon is usually a bare Dashicon slug string, but if the block was configured with a custom icon image in the block editor UI, it can also be an object ({"background": "...", "foreground": "...", "src": "..."}) instead.

acpt/save-block

Input

Property
Type
Required
Notes

name

string

Yes

If a block with this name already exists, it's updated instead of duplicated

title

string

Yes

category

string

Yes

The Gutenberg block category slug

icon

string

Yes

Any Dashicon slug

postTypes

array<string>

Yes

Post types the block is available in

controls

array

Yes

The block's editable controls — each item needs at least a name; type is one of Checkbox, Radio, Select, SelectMulti, Toggle, Text, Textarea, Number, Range, Email, Phone

css

string|null

No

callback

string|null

No

keywords

array|null

No

acpt/delete-block

Input

Property
Type
Required

name

string

Yes

Last updated