> ## Documentation Index
> Fetch the complete documentation index at: https://ai-kb.automationanywhere.com/llms.txt
> Use this file to discover all available pages before exploring further.

# WordPress Toolkit

> Connect WordPress to EKB Platform agents and workflows to create, edit, publish, and manage pages, posts, media, and taxonomy.

The WordPress toolkit connects a WordPress site to EKB Platform using an Application Password and lets agents and workflows find and read pages and posts, create and edit content using structured blocks, publish and unpublish pages, manage media, handle taxonomy, and restore revisions. The toolkit runs as the WordPress user configured on the agent and can only perform actions that account is permitted to do.

## Prerequisites

* A WordPress site running **WordPress 5.6 or later** on **HTTPS**.
* Permalinks set to anything other than **Plain** (go to **Settings → Permalinks** to check).
* A WordPress Application Password — not your account password. Go to **Users → Profile → Application Passwords**, enter a name such as `EKB Platform Agent`, click **Add New Application Password**, and copy the generated string immediately. WordPress shows it only once.
* Access to an EKB Platform project where you can configure an agent or workflow.

<Warning>
  The toolkit runs as the WordPress user configured on the agent. Every person who uses the agent acts as that same WordPress user — choose an account scoped to the job, not your administrator login. Never use your WordPress account password; always use an Application Password. Revoke the Application Password under Users → Profile to immediately cut off agent access.
</Warning>

## Setup

<Steps>
  <Step title="Open the agent or workflow in EKB Platform">
    Open the target agent and choose **Toolkits**. Add the **WordPress** toolkit.
  </Step>

  <Step title="Enter the site URL">
    Enter the **Site URL** as the site root only — for example `https://your-site.com`. Do not include `/wp-admin`, `/wp-login.php`, or `/wp-json`.
  </Step>

  <Step title="Configure authentication">
    Leave **Authentication Method** set to **Application Password**. Enter your WordPress **username** (not the label you gave the Application Password) and paste the generated Application Password credential.
  </Step>

  <Step title="Enable the tools you need">
    Enable only the tools required for the job. Start with read-only tools: **Find Pages**, **List Pages**, **Get Page**, **List Posts**, and **Get Post**.
  </Step>

  <Step title="Test the connection">
    Save the configuration and run **Test Connection** first. A successful response shows the connected WordPress username and its capabilities.
  </Step>

  <Step title="Test with a draft">
    Create one throwaway draft page to confirm write access before working on live content.
  </Step>
</Steps>

## Available tools

### Find & Read

| Tool           | Description                                                                                                         |
| -------------- | ------------------------------------------------------------------------------------------------------------------- |
| **Find Pages** | Resolves a natural-language page name to page candidates. Always call this before editing a page mentioned by name. |
| **List Pages** | Lists pages with optional filters for status, search, parent, and pagination.                                       |
| **Get Page**   | Returns one page with editable block source content.                                                                |

### Create & Edit

| Tool              | Description                                                                                             |
| ----------------- | ------------------------------------------------------------------------------------------------------- |
| **Create Page**   | Creates a page. Default status is draft. Pass a `blocks` array for structured Gutenberg content.        |
| **Update Page**   | Full rewrite of a page. Prefer Append Blocks for additive changes.                                      |
| **Append Blocks** | Adds new blocks to the end of a page without touching existing content. Recommended for additive edits. |

### Publish

| Tool               | Description                                                                                    |
| ------------------ | ---------------------------------------------------------------------------------------------- |
| **Publish Page**   | Sets a page status to published. Requires `publish_pages` capability on the connected account. |
| **Unpublish Page** | Returns a page to draft status. Does not trash or delete the page.                             |
| **Schedule Page**  | Sets a page to publish automatically at a future date and time.                                |

### Delete & Restore

| Tool             | Description                                                                                    |
| ---------------- | ---------------------------------------------------------------------------------------------- |
| **Delete Page**  | Moves a page to trash by default. Set `force: true` only for permanent, irreversible deletion. |
| **Restore Page** | Untrashes a page and sets it back to draft by default.                                         |

### History

| Tool                 | Description                                                                           |
| -------------------- | ------------------------------------------------------------------------------------- |
| **List Revisions**   | Lists saved revisions for a page.                                                     |
| **Get Revision**     | Returns the raw block content of a specific revision.                                 |
| **Restore Revision** | Reads a revision's content and writes it back onto the page, creating a new revision. |

### Posts

| Tool            | Description                                                                                 |
| --------------- | ------------------------------------------------------------------------------------------- |
| **List Posts**  | Lists posts with optional filters for status, search, categories, and tags.                 |
| **Get Post**    | Returns one post with editable block source content.                                        |
| **Create Post** | Creates a post with optional categories, tags, and featured media. Default status is draft. |
| **Update Post** | Updates a post. Supports `expected_modified_gmt` to detect concurrent edits.                |
| **Delete Post** | Moves a post to trash by default. `force: true` permanently deletes.                        |

### Media

| Tool             | Description                                                                                          |
| ---------------- | ---------------------------------------------------------------------------------------------------- |
| **List Media**   | Lists media library items with optional search and pagination.                                       |
| **Upload Media** | Uploads a file by base64 string or URL. Returns the media ID and source URL for use in image blocks. |
| **Delete Media** | Permanently deletes a media item. Confirm before calling.                                            |

### Taxonomy

| Tool                | Description                                                                         |
| ------------------- | ----------------------------------------------------------------------------------- |
| **List Categories** | Lists post categories. Returns category IDs for use in Create Post and Update Post. |
| **List Tags**       | Lists post tags. Returns tag IDs for use in Create Post and Update Post.            |
| **Create Category** | Creates a new post category.                                                        |
| **Create Tag**      | Creates a new post tag.                                                             |

### Advanced

| Tool                | Description                                                                                                                                     |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| **Search**          | Site-wide search across posts, pages, and terms.                                                                                                |
| **Test Connection** | Verifies credentials and returns the connected username and capabilities. Run this first after setup.                                           |
| **Custom API Call** | Authenticated request to any WordPress REST route. Bypasses verification and block validation. Use only when no dedicated tool covers the need. |

## Use cases

* Find a page by name, read its current content, append a new FAQ section, and confirm the change was applied.
* Draft a new product page with structured Gutenberg blocks, review it, and publish it once approved.
* Create a blog post with categories and tags, upload a featured image, and schedule it for a future date.
* Restore a page to a previous revision after an edit that introduced a problem.
* Search the media library for an existing image before uploading a duplicate.

## Troubleshooting

| Symptom                                      | Likely cause                                                                                         | Fix                                                                                                                 |
| -------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| Wall of HTML or themed "Page not found"      | The Site URL contains a path such as `/wp-admin`.                                                    | Set Site URL to the site root only — `https://your-site.com`.                                                       |
| Every call returns 404 and Site URL is clean | Permalinks are set to Plain, making the REST API unreachable.                                        | Go to **Settings → Permalinks** and select any option other than Plain.                                             |
| `401 rest_not_logged_in`                     | The Username field contains the Application Password label, or an account password was used instead. | Use the WordPress login username and the generated Application Password string. Run **Test Connection** to confirm. |
| No Application Passwords section in profile  | The site is not on HTTPS, or WordPress is older than 5.6.                                            | Fix the site SSL certificate, or install the WP-API Basic-Auth plugin for HTTP-only development sites.              |
| `rest_cannot_*` permissions error            | The connected account's role does not permit the requested action.                                   | Use an account with the required capabilities — publishing requires `publish_pages`.                                |
| TLS or certificate error                     | A self-signed certificate is in use.                                                                 | Uncheck **Verify TLS certificate** on development sites only. Never disable on production.                          |
