Knowledge & tools

WordPress tool

The WordPress tool lets an agent manage a WordPress site over its REST API (/wp-json/wp/v2) - publish and edit posts and pages, upload media, manage categories and tags, moderate comments, and search. One configuration holds the site URL and credentials; the agent picks an action per call.

This replaces the old api.wordpress_* "API Call" presets (Create Post / Recent Posts / Update Post / Upload Media) with a single configuration and a single agent function.

Connect WordPress

The quickest way: approve Hania on your own site. There is no password to create or copy.

  1. In Hania, go to Tools → Add tool → WordPress, enter your site's address (for example https://yourdomain.com) and click Connect WordPress. When an agent asks for your WordPress details in a chat, the same form, with Connect WordPress, is in the chat card.
  2. Your site's own approval page opens in a new tab. If you're not logged in to WordPress, log in first. Log in as the user the agent should act as - its role decides what the agent can do (see below).
  3. Click Yes, I approve of this connection. WordPress creates an Application Password for Hania and hands it over directly; you never see or copy it.
  4. The tab returns to Hania and confirms the connection. If you started from a chat, the agent carries on by itself and you can close the tab.

The configuration is named WordPress (yourdomain.com) and shows as Connected with the site and username. Connecting the same site again updates it rather than adding a second one.

  • Reconnect - open the configuration on the Tools page and click Reconnect. Do this if the Application Password was revoked on your site: the agent's WordPress actions then fail with a 401 until you reconnect.
  • Credentials are managed for you - a connected configuration doesn't show the username or password fields, and only reconnecting replaces them.
  • The approval link lasts 10 minutes and works once. If it expires, click Connect WordPress again.
  • Left before approving? The connection is saved with your site's address and no login, and it doesn't count as connected. An agent that needs WordPress still lists it as something to connect, and Connect WordPress picks that same connection up rather than making a second one.

Sites hosted on WordPress.com

These connect with the same button. The only difference is that the approval page is on WordPress.com rather than on your own site. Entering a username and Application Password by hand isn't available for a WordPress.com site: if you try, Hania tells you so and puts the Connect button back.

If Connect doesn't work

Connect uses WordPress's built-in Application Passwords, so it can't work where they can't. In each of these cases the manual route fails too, so fix the cause first:

  • The site isn't on HTTPS - WordPress only offers Application Passwords over HTTPS.
  • A plugin turned Application Passwords off - often a security plugin. Re-enable the feature in that plugin.
  • The address is wrong, or the REST API is switched off - Hania can't find a WordPress REST API at that address and says so. Check the address, and that nothing on the site has disabled the REST API.
  • The host strips the Authorization header - your site refuses the new password. Ask your host to pass the Authorization header through to WordPress.

Configuration

Unlike the social/ESP tools, WordPress's API host is per-site, so the configuration carries a site URL alongside the credentials. One configuration = one site - add several configurations to manage several sites. Connect fills in the username and Application Password for you; when you enter them yourself, all three fields are needed:

  • Site URL (required) - your site's home URL, e.g. https://yourdomain.com. Hania appends the REST path (/wp-json/wp/v2) automatically; pasting the full REST URL or a trailing slash also works. The site must have the WordPress REST API enabled (on by default in modern WordPress). Use HTTPS.
  • Username (required) - the WordPress username (not the email, unless your site signs in by email) that owns the Application Password. The user's role determines what the agent can do - see below.
  • Application Password (required) - a WordPress Application Password (not your login password). Stored encrypted and never shown again; on edit, leave it blank to keep the stored one. See how to create one.

Pick a role-appropriate account: an Administrator or Editor can publish, edit any post, upload media, manage categories, and moderate comments; an Author is limited to their own posts. Use a dedicated account with only the permissions you want the agent to have.

Connect manually with an Application Password

Use this if you'd rather not use Connect: choose Enter the details manually instead in the form. Application Passwords let an external app authenticate to your site without using your main password, and can be revoked any time without changing your login. (Built into WordPress 5.6+; the site must be served over HTTPS.)

On a self-hosted WordPress site:

  1. Log in to your site's wp-admin dashboard as the user the agent will act as (an Administrator or Editor for full capability).
  2. Go to Users → Profile (or Users → All Users → [the user] → Edit).
  3. Scroll to the Application Passwords section near the bottom.
  4. Type a name you'll recognize (e.g. Hania AI) in New Application Password Name and click Add New Application Password.
  5. WordPress shows the generated password once, in six groups of four characters (e.g. abcd efgh ijkl mnop qrst uvwx). Copy it now - you can't view it again.
  6. In Hania, paste your site URL, the username from step 1, and this Application Password. Paste it exactly as shown - the spaces are fine.
Not visible? The Application Passwords section is hidden if the site isn't on HTTPS, if a security plugin disabled the feature, or if the REST API / Application Passwords are blocked. Enable HTTPS / re-enable the feature, then retry.
Revoking: return to Users → Profile → Application Passwords and click Revoke next to the entry. The agent immediately loses access; your login is unaffected.
Sites hosted on WordPress.com: the manual route isn't available for these. Use Connect WordPress instead.

What it can do

23 actions, grouped. The agent chooses one per call:

  • Posts - create_post (title + HTML content, optional status/excerpt/categories/tags/featured image), update_post, get_post, list_posts (filter by search/status/page), delete_post.
  • Pages - create_page, update_page, get_page, list_pages, delete_page (same lifecycle for static pages).
  • Media - upload_media (sideload a public image URL; returns an attachment id to use as a featured image), list_media, get_media, delete_media.
  • Taxonomy - list_categories, create_category, list_tags, create_tag.
  • Comments - list_comments, moderate_comment (approve / hold / spam / trash), reply_comment, delete_comment.
  • Search - search (site-wide across content).

Behaviors & gotchas

  • One site per configuration. The site URL is fixed per config; add more configurations for more sites (only the name must be unique per workspace).
  • Media is uploaded from a URL, not a file. upload_media takes a public https image URL; Hania fetches it (through an SSRF safety gate, with a size cap) and uploads the bytes to the Media Library. Typical flow: find/generate an image URL → upload_media → use the returned id as the post's featured image.
  • Delete is permanent. delete_* actions remove content permanently (WordPress media has no Trash, and this is applied uniformly). Pair with the classification flags below if you want a safety gate.
  • Comments can't be added to drafts. A reply/comment requires a published post.
  • Status values - posts/pages use publish or draft; comment moderation uses approved / hold / spam / trash.
  • This is the content tool, not email - it doesn't send email; the SMTP/email tools are separate.
  • Lists are summarized (id/title/link/date/status) to keep responses lean; full content comes from get_post / get_page.

Safety in autonomous runs

Like any tool, the WordPress tool carries a safety classification (read-only / destructive / sends-data-externally) that governs scheduled or triggered (autonomous) runs. You'll find it under Show advanced at the bottom of the configuration form. A new configuration starts as Read-only with the other two off, which blocks nothing in autonomous runs. Suggested settings, which you can change:

  • Destructive - reasonable to enable: the tool can permanently delete posts, pages, media and comments, and publish content. With it on, the platform's destructive-action gate requires "Allow destructive actions in autonomous runs" on the bot (whole-tool gate).
  • Read-only - turn this off, since the tool writes; a non-read-only tool is exempt from the no-progress guard, so its writes can legitimately repeat in long autonomous runs.
  • Sends data externally - leave off. The destination is your configured site, not an LLM-chosen URL, so the egress gate doesn't apply.

Interactive chat is never gated by these flags.

Connection & errors

When you enter the details yourself, all three fields are required, so a missing one is rejected at save. At runtime, WordPress errors surface with their real HTTP status - e.g. 401/403 for a bad or insufficient credential, or a 404 for a wrong id. A quick read (the agent reading the current user or listing posts) confirms the credential works.

Lifecycle & post-call use

  • Never ends a session - it's a normal action tool.
  • Post-call-hook eligible - it can run after a conversation (see Post-call hooks), e.g. "after the call, draft a recap post."