KosmoKrator

cms

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.

8 functions 6 read 2 write API key auth

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 use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
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

Call WordPress Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

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

Use the provider shortcut form for shorter human-facing commands.

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

Agent Discovery Commands

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

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to WordPress.

wordpress.wordpress_create_post

Write write

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.

Parameters
title, content, status, excerpt, author, categories, tags, featured_media, slug

Generic CLI call

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

Provider shortcut

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

Read read

Get the currently authenticated WordPress user profile. Returns user ID, name, email, roles, and capabilities.

Parameters
none

Generic CLI call

kosmo integrations:call wordpress.wordpress_get_current_user '{}' --json

Provider shortcut

kosmo integrations:wordpress wordpress_get_current_user '{}' --json

wordpress.wordpress_get_post

Read read

Get a single WordPress post by its ID. Returns the full post object including title, content, excerpt, author, categories, tags, and metadata.

Parameters
id

Generic CLI call

kosmo integrations:call wordpress.wordpress_get_post '{"id":1}' --json

Provider shortcut

kosmo integrations:wordpress wordpress_get_post '{"id":1}' --json

wordpress.wordpress_list_comments

Read read

List comments from the WordPress site. Supports filtering by post, status, author, and search. Returns comment IDs, content, author info, and dates.

Parameters
per_page, page, post, search, status, author, order, orderby

Generic CLI call

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

Provider shortcut

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

Read read

List pages from the WordPress site. Supports filtering by status, author, search, and parent. Returns page IDs, titles, dates, and statuses.

Parameters
per_page, page, search, status, author, parent, order, orderby

Generic CLI call

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

Provider shortcut

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

Read read

List posts from the WordPress site. Supports filtering by status, author, category, tag, and search. Returns post IDs, titles, dates, and statuses.

Parameters
per_page, page, search, status, author, categories, tags, order, orderby

Generic CLI call

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

Provider shortcut

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

Read read

List users registered on the WordPress site. Supports filtering by role and search. Returns user IDs, names, and email addresses.

Parameters
per_page, page, search, roles, order, orderby

Generic CLI call

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

Provider shortcut

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

Write write

Update an existing WordPress post. Provide the post ID and any fields to change: title, content, status, categories, tags, etc.

Parameters
id, title, content, status, excerpt, author, categories, tags, featured_media, slug

Generic CLI call

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

Provider shortcut

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

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.

Operation
Write write
Schema command
kosmo integrations:schema wordpress.wordpress_create_post --json
ParameterTypeRequiredDescription
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

Get the currently authenticated WordPress user profile. Returns user ID, name, email, roles, and capabilities.

Operation
Read read
Schema command
kosmo integrations:schema wordpress.wordpress_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

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.

Operation
Read read
Schema command
kosmo integrations:schema wordpress.wordpress_get_post --json
ParameterTypeRequiredDescription
id integer yes The post ID to retrieve.

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.

Operation
Read read
Schema command
kosmo integrations:schema wordpress.wordpress_list_comments --json
ParameterTypeRequiredDescription
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

List pages from the WordPress site. Supports filtering by status, author, search, and parent. Returns page IDs, titles, dates, and statuses.

Operation
Read read
Schema command
kosmo integrations:schema wordpress.wordpress_list_pages --json
ParameterTypeRequiredDescription
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

List posts from the WordPress site. Supports filtering by status, author, category, tag, and search. Returns post IDs, titles, dates, and statuses.

Operation
Read read
Schema command
kosmo integrations:schema wordpress.wordpress_list_posts --json
ParameterTypeRequiredDescription
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

List users registered on the WordPress site. Supports filtering by role and search. Returns user IDs, names, and email addresses.

Operation
Read read
Schema command
kosmo integrations:schema wordpress.wordpress_list_users --json
ParameterTypeRequiredDescription
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

Update an existing WordPress post. Provide the post ID and any fields to change: title, content, status, categories, tags, etc.

Operation
Write write
Schema command
kosmo integrations:schema wordpress.wordpress_update_post --json
ParameterTypeRequiredDescription
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.