Abilities Reference
Abilities are the atomic actions that Gratis AI Agent can invoke on your WordPress installation. Each ability is a registered PHP class that exposes a JSON schema — the agent reads this schema at runtime to understand what parameters are required and what the ability returns.
This page documents all abilities shipping with Gratis AI Agent v1.9.0.
Custom Post Types
These abilities manage custom post types (CPTs) registered through the agent. Registrations are persisted to the WordPress options table so they survive plugin deactivation and reactivation.
register_post_type
Registers a new custom post type.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | The post type key (max 20 characters, no uppercase, no spaces) |
singular_label | string | Yes | Human-readable singular name, e.g. Portfolio Item |
plural_label | string | Yes | Human-readable plural name, e.g. Portfolio Items |
public | boolean | No | Whether the post type is publicly accessible. Default true |
supports | array | No | Features to support: title, editor, thumbnail, excerpt, comments, revisions, custom-fields. Default ["title","editor"] |
has_archive | boolean | No | Whether a post type archive page is enabled. Default false |
menu_icon | string | No | Dashicons class or URL for the admin menu icon. Default "dashicons-admin-post" |
rewrite_slug | string | No | URL slug for the post type. Defaults to slug |
Example
{
"slug": "portfolio",
"singular_label": "Portfolio Item",
"plural_label": "Portfolio Items",
"public": true,
"supports": ["title", "editor", "thumbnail"],
"has_archive": true,
"menu_icon": "dashicons-portfolio"
}
Returns { "success": true, "slug": "portfolio" }
list_post_types
Returns all custom post types registered by the agent.
Parameters — none
Returns
{
"post_types": [
{
"slug": "portfolio",
"singular_label": "Portfolio Item",
"plural_label": "Portfolio Items",
"public": true
}
]
}
delete_post_type
Unregisters a custom post type previously registered by the agent. Existing posts of that type remain in the database but are no longer accessible via the post type.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | The post type key to remove |
Returns { "success": true, "slug": "portfolio" }
Custom Taxonomies
These abilities manage custom taxonomies. Like CPTs, taxonomy registrations are persisted.
register_taxonomy
Registers a new custom taxonomy.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | The taxonomy key (max 32 characters) |
singular_label | string | Yes | Human-readable singular name, e.g. Project Category |
plural_label | string | Yes | Human-readable plural name, e.g. Project Categories |
post_types | array | Yes | Post type slugs this taxonomy should be attached to |
hierarchical | boolean | No | true for category-style, false for tag-style. Default true |
public | boolean | No | Whether terms are publicly accessible. Default true |
rewrite_slug | string | No | URL slug for the taxonomy. Defaults to slug |
Example
{
"slug": "project-category",
"singular_label": "Project Category",
"plural_label": "Project Categories",
"post_types": ["portfolio"],
"hierarchical": true
}
Returns { "success": true, "slug": "project-category" }
list_taxonomies
Returns all custom taxonomies registered by the agent.
Parameters — none
Returns
{
"taxonomies": [
{
"slug": "project-category",
"singular_label": "Project Category",
"post_types": ["portfolio"],
"hierarchical": true
}
]
}
delete_taxonomy
Unregisters a custom taxonomy previously registered by the agent.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | The taxonomy key to remove |
Returns { "success": true, "slug": "project-category" }
Design System
Design system abilities modify the visual presentation of the WordPress site — from custom CSS to block patterns and the site logo.
inject_custom_css
Appends CSS to the site's <head> via wp_add_inline_style. CSS is stored in the gratis_ai_agent_custom_css option and dequeued cleanly when the ability is reset.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
css | string | Yes | Valid CSS to inject |
label | string | No | Human-readable label for this CSS block, used in debug logs. Default "agent-injected" |
replace | boolean | No | If true, replaces all previously injected CSS. Default false (appends) |
Example
{
"css": ":root { --primary: #1a1a2e; --accent: #e94560; } body { font-family: 'Inter', sans-serif; }",
"label": "brand-colours",
"replace": false
}
Returns { "success": true, "bytes": 96 }
add_block_pattern
Registers a reusable block pattern in the WordPress pattern library.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | Pattern identifier, e.g. gratis/hero-dark |
title | string | Yes | Human-readable pattern name shown in the editor |
content | string | Yes | Serialised block markup (HTML) for the pattern |
categories | array | No | Pattern category slugs, e.g. ["featured", "hero"] |
description | string | No | Short description shown in the pattern picker |
keywords | array | No | Search keywords |
Returns { "success": true, "slug": "gratis/hero-dark" }
list_block_patterns
Lists all block patterns registered by the agent.
Parameters — none
Returns
{
"patterns": [
{
"slug": "gratis/hero-dark",
"title": "Dark Hero",
"categories": ["hero"]
}
]
}
set_site_logo
Sets the WordPress site logo to a given attachment ID or a remote image URL. When a URL is provided, the image is downloaded and imported into the Media Library.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
attachment_id | integer | No | ID of an existing Media Library attachment |
url | string | No | Remote image URL to import and set as the logo |
One of attachment_id or url must be provided.
Returns { "success": true, "attachment_id": 42 }