productivity
WordPress CLI for AI Agents
Use the WordPress CLI from KosmoKrator to call WordPress tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.WordPress CLI Setup
WordPress can be configured headlessly with `kosmokrator integrations:configure wordpress`.
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash
# Configure and verify this integration.
kosmokrator integrations:configure wordpress --set url="$WORDPRESS_URL" --set username="$WORDPRESS_USERNAME" --set application_password="$WORDPRESS_APPLICATION_PASSWORD" --enable --read allow --write ask --json
kosmokrator integrations:doctor wordpress --json
kosmokrator integrations:status --json Credentials
Authentication type: API key api_key. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.
| Key | Env var | Type | Required | Label |
|---|---|---|---|---|
url | WORDPRESS_URL | URL url | yes | WordPress REST API URL |
username | WORDPRESS_USERNAME | Text text | yes | Username |
application_password | WORDPRESS_APPLICATION_PASSWORD | Secret secret | yes | Application Password |
Command Patterns
The generic command is stable across every integration. The provider shortcut is shorter for humans.
kosmo integrations:call wordpress.wordpress_create_post '{"title":"example_title","content":"example_content","status":"example_status","excerpt":"example_excerpt","author":1,"categories":"example_categories","tags":"example_tags","featured_media":1}' --json kosmo integrations:wordpress wordpress_create_post '{"title":"example_title","content":"example_content","status":"example_status","excerpt":"example_excerpt","author":1,"categories":"example_categories","tags":"example_tags","featured_media":1}' --json Discovery
These commands return structured output for coding agents that need to inspect capabilities before choosing a function.
kosmo integrations:docs wordpress --json
kosmo integrations:docs wordpress.wordpress_create_post --json
kosmo integrations:schema wordpress.wordpress_create_post --json
kosmo integrations:search "WordPress" --json
kosmo integrations:list --json Automation Contexts
The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.
CLI Functions
Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.
wordpress.wordpress_create_post
Create a new post on the WordPress site. Requires a title. Content, status, categories, and tags can be specified. Defaults to draft status for safety.
write - Parameters
- title, content, status, excerpt, author, categories, tags, featured_media, slug
kosmo integrations:call wordpress.wordpress_create_post '{"title":"example_title","content":"example_content","status":"example_status","excerpt":"example_excerpt","author":1,"categories":"example_categories","tags":"example_tags","featured_media":1}' --json kosmo integrations:wordpress wordpress_create_post '{"title":"example_title","content":"example_content","status":"example_status","excerpt":"example_excerpt","author":1,"categories":"example_categories","tags":"example_tags","featured_media":1}' --json wordpress.wordpress_get_current_user
Get the currently authenticated WordPress user profile. Returns user ID, name, email, roles, and capabilities.
read - Parameters
- none
kosmo integrations:call wordpress.wordpress_get_current_user '{}' --json kosmo integrations:wordpress wordpress_get_current_user '{}' --json wordpress.wordpress_get_post
Get a single WordPress post by its ID. Returns the full post object including title, content, excerpt, author, categories, tags, and metadata.
read - Parameters
- id
kosmo integrations:call wordpress.wordpress_get_post '{"id":1}' --json kosmo integrations:wordpress wordpress_get_post '{"id":1}' --json wordpress.wordpress_list_comments
List comments from the WordPress site. Supports filtering by post, status, author, and search. Returns comment IDs, content, author info, and dates.
read - Parameters
- per_page, page, post, search, status, author, order, orderby
kosmo integrations:call wordpress.wordpress_list_comments '{"per_page":1,"page":1,"post":1,"search":"example_search","status":"example_status","author":1,"order":"example_order","orderby":"example_orderby"}' --json kosmo integrations:wordpress wordpress_list_comments '{"per_page":1,"page":1,"post":1,"search":"example_search","status":"example_status","author":1,"order":"example_order","orderby":"example_orderby"}' --json wordpress.wordpress_list_pages
List pages from the WordPress site. Supports filtering by status, author, search, and parent. Returns page IDs, titles, dates, and statuses.
read - Parameters
- per_page, page, search, status, author, parent, order, orderby
kosmo integrations:call wordpress.wordpress_list_pages '{"per_page":1,"page":1,"search":"example_search","status":"example_status","author":1,"parent":1,"order":"example_order","orderby":"example_orderby"}' --json kosmo integrations:wordpress wordpress_list_pages '{"per_page":1,"page":1,"search":"example_search","status":"example_status","author":1,"parent":1,"order":"example_order","orderby":"example_orderby"}' --json wordpress.wordpress_list_posts
List posts from the WordPress site. Supports filtering by status, author, category, tag, and search. Returns post IDs, titles, dates, and statuses.
read - Parameters
- per_page, page, search, status, author, categories, tags, order, orderby
kosmo integrations:call wordpress.wordpress_list_posts '{"per_page":1,"page":1,"search":"example_search","status":"example_status","author":1,"categories":"example_categories","tags":"example_tags","order":"example_order"}' --json kosmo integrations:wordpress wordpress_list_posts '{"per_page":1,"page":1,"search":"example_search","status":"example_status","author":1,"categories":"example_categories","tags":"example_tags","order":"example_order"}' --json wordpress.wordpress_list_users
List users registered on the WordPress site. Supports filtering by role and search. Returns user IDs, names, and email addresses.
read - Parameters
- per_page, page, search, roles, order, orderby
kosmo integrations:call wordpress.wordpress_list_users '{"per_page":1,"page":1,"search":"example_search","roles":"example_roles","order":"example_order","orderby":"example_orderby"}' --json kosmo integrations:wordpress wordpress_list_users '{"per_page":1,"page":1,"search":"example_search","roles":"example_roles","order":"example_order","orderby":"example_orderby"}' --json wordpress.wordpress_update_post
Update an existing WordPress post. Provide the post ID and any fields to change: title, content, status, categories, tags, etc.
write - Parameters
- id, title, content, status, excerpt, author, categories, tags, featured_media, slug
kosmo integrations:call wordpress.wordpress_update_post '{"id":1,"title":"example_title","content":"example_content","status":"example_status","excerpt":"example_excerpt","author":1,"categories":"example_categories","tags":"example_tags"}' --json kosmo integrations:wordpress wordpress_update_post '{"id":1,"title":"example_title","content":"example_content","status":"example_status","excerpt":"example_excerpt","author":1,"categories":"example_categories","tags":"example_tags"}' --json Function Schemas
Use these parameter tables when building CLI payloads without calling integrations:schema first.
wordpress.wordpress_create_post 9 parameters
kosmo integrations:schema wordpress.wordpress_create_post --json | Parameter | Type | Required | Description |
|---|---|---|---|
title | string | yes | The post title. |
content | string | no | The post content in HTML format. |
status | string | no | Post status: draft, publish, pending, private. Default: draft. |
excerpt | string | no | The post excerpt in HTML format. |
author | integer | no | Author user ID. Defaults to the authenticated user. |
categories | array | no | Array of category IDs to assign. |
tags | array | no | Array of tag IDs to assign. |
featured_media | integer | no | Featured image (media) ID. |
slug | string | no | URL slug for the post. Auto-generated from title if omitted. |
wordpress.wordpress_get_current_user 0 parameters
kosmo integrations:schema wordpress.wordpress_get_current_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
wordpress.wordpress_get_post 1 parameters
kosmo integrations:schema wordpress.wordpress_get_post --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The post ID to retrieve. |
wordpress.wordpress_list_comments 8 parameters
kosmo integrations:schema wordpress.wordpress_list_comments --json | Parameter | Type | Required | Description |
|---|---|---|---|
per_page | integer | no | Number of comments to return per page (default: 10, max: 100). |
page | integer | no | Page number for pagination (default: 1). |
post | integer | no | Post ID to filter comments by. |
search | string | no | Search term to filter comments by content or author. |
status | string | no | Comment status filter: approved, hold, spam, trash, or any. Default: approved. |
author | integer | no | Comment author user ID to filter by. |
order | string | no | Sort order: asc or desc (default: desc). |
orderby | string | no | Sort field: date, date_gmt, id, etc. (default: date_gmt). |
wordpress.wordpress_list_pages 8 parameters
kosmo integrations:schema wordpress.wordpress_list_pages --json | Parameter | Type | Required | Description |
|---|---|---|---|
per_page | integer | no | Number of pages to return per page (default: 10, max: 100). |
page | integer | no | Page number for pagination (default: 1). |
search | string | no | Search term to filter pages by title or content. |
status | string | no | Page status filter: publish, draft, pending, private, or any. Default: publish. |
author | integer | no | Author user ID to filter pages by. |
parent | integer | no | Parent page ID to filter by (for hierarchical pages). |
order | string | no | Sort order: asc or desc (default: desc). |
orderby | string | no | Sort field: date, title, author, id, menu_order, etc. (default: date). |
wordpress.wordpress_list_posts 9 parameters
kosmo integrations:schema wordpress.wordpress_list_posts --json | Parameter | Type | Required | Description |
|---|---|---|---|
per_page | integer | no | Number of posts to return per page (default: 10, max: 100). |
page | integer | no | Page number for pagination (default: 1). |
search | string | no | Search term to filter posts by title or content. |
status | string | no | Post status filter: publish, draft, pending, private, trash, or any. Default: publish. |
author | integer | no | Author user ID to filter posts by. |
categories | string | no | Comma-separated category IDs to filter by. |
tags | string | no | Comma-separated tag IDs to filter by. |
order | string | no | Sort order: asc or desc (default: desc). |
orderby | string | no | Sort field: date, title, author, id, etc. (default: date). |
wordpress.wordpress_list_users 6 parameters
kosmo integrations:schema wordpress.wordpress_list_users --json | Parameter | Type | Required | Description |
|---|---|---|---|
per_page | integer | no | Number of users to return per page (default: 10, max: 100). |
page | integer | no | Page number for pagination (default: 1). |
search | string | no | Search term to filter users by name, email, or slug. |
roles | string | no | Comma-separated roles to filter by (e.g. administrator, editor, author). |
order | string | no | Sort order: asc or desc (default: asc). |
orderby | string | no | Sort field: name, id, registered_date, etc. (default: name). |
wordpress.wordpress_update_post 10 parameters
kosmo integrations:schema wordpress.wordpress_update_post --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The post ID to update. |
title | string | no | New post title. |
content | string | no | New post content in HTML format. |
status | string | no | New post status: draft, publish, pending, private. |
excerpt | string | no | New post excerpt in HTML format. |
author | integer | no | New author user ID. |
categories | array | no | Array of category IDs to assign (replaces existing). |
tags | array | no | Array of tag IDs to assign (replaces existing). |
featured_media | integer | no | Featured image (media) ID. |
slug | string | no | New URL slug for the post. |
Permissions
Headless calls still follow the integration read/write permission policy. Configure read/write defaults with
integrations:configure. Add --force only for trusted automation that should bypass that policy.