# WordPress

Unspar can publish finished articles to your WordPress site as normal posts, with their images. You connect the site once with an application password.

Web version: https://www.unspar.com/docs/guides/wordpress/

A WordPress outlet connects one WordPress site to Unspar. An outlet is a destination where Unspar publishes finished articles. Once your site is connected, choosing **Publish** on an article sends it straight to WordPress as a post. For an overview of how outlets work, see [Outlets and publishing](https://www.unspar.com/docs/guides/outlets-and-publishing/).

Unspar connects to WordPress through its built-in REST API, which is the interface WordPress provides for external apps. You don't need to install a plugin.

## What do you need?

- A WordPress site on HTTPS, running WordPress 5.6 or newer.
- A WordPress user who can publish posts and upload images, such as an Editor or Administrator.
- An application password for that user.

An application password is a separate password WordPress generates for a single app. Unspar uses it to log in instead of your regular password. Nobody can use it to sign in to your WordPress dashboard, and you can revoke it in WordPress at any time without changing your own password.

Unspar doesn't set the post author itself. WordPress assigns every post to the user who owns the application password, so create the password under the account you want listed as the author.

## Create an application password

1. Log in to WordPress as the user who should be the author.
2. Open **Users** and then **Profile**.
3. Scroll down to **Application Passwords**. Type "Unspar" under **New Application Password Name**.
4. Choose **Add New Application Password**.
5. Copy the password WordPress shows. It only appears once.

The password comes in groups of four characters separated by spaces. You can paste it with the spaces included.

If you don't see an **Application Passwords** section in your profile, either your site isn't on HTTPS, or a security plugin or your host has turned the feature off.

## Connect the site in Unspar

1. Open [Outlets](https://app.unspar.com/outlets) in the sidebar and choose **New outlet**.
2. On the **Assistant** tab, type your site's address under **Website URL or domain**, like `example.com`, and choose **Detect**. Unspar shows "WordPress detected.", fills in the **WordPress REST API URL** (such as `https://example.com/wp-json`), and suggests a **Name**.
3. Under **Connection**, enter your WordPress **Username** and paste the **Application password**.
4. Under **Publishing defaults**, pick a **Default status** and, if you want, a **Default category**. Both are explained below. Leave **Default format** on **HTML**.
5. Choose **Test connection**. When it says "Connection successful.", choose **Create outlet**.

If Unspar doesn't recognize your site, select the **WordPress** card yourself and enter the REST API address manually: your site's address with `/wp-json` at the end.

The connection test checks that Unspar can log in and read posts, but it doesn't check whether the user has permission to publish. Publish a first article and check it on your site to be sure.

![Outlets page with the New outlet button marked](https://www.unspar.com/images/docs/wp-1-outlets.webp)

Step 1: Start on the Outlets page and choose New outlet.

![Create outlet form with blog.example.com typed under Website URL or domain and the Detect button](https://www.unspar.com/images/docs/wp-2-detect.webp)

Step 2: Type the site's address and choose Detect. For a WordPress site, Unspar selects the WordPress card and fills in the API address.

![Connection fields: WordPress REST API URL, Username and Application password](https://www.unspar.com/images/docs/wp-3-connection.webp)

Step 3: Enter the WordPress username and paste the application password.

![Publishing defaults with Name, Default status, Default category and Default format, and the Test connection and Create outlet buttons](https://www.unspar.com/images/docs/wp-4-defaults.webp)

Step 4–5: Pick the defaults, test the connection, then create the outlet.

## What does a post from Unspar contain?

Each post from Unspar includes:

- the title and the body text as HTML
- the slug, which is the last part of the post's URL
- the featured image and any in-text images, uploaded to your Media Library with their alt text and captions
- the meta description Unspar wrote, saved as the post's excerpt
- the **Default category**, if you set one

Unspar doesn't send tags or fields for SEO plugins, such as a focus keyword. You can add those in WordPress after the post arrives. WordPress timestamps the post when it receives it, so a scheduled article gets the date and time Unspar sent it.

## Should posts go live or arrive as drafts?

**Default status** controls what happens to each new post. With **Published**, the post goes live as soon as WordPress receives it. With **Draft**, it waits in WordPress until you publish it yourself. New outlets default to **Published**.

**Draft** is useful when you want a final look in WordPress, for example to add tags. In Unspar, the article still counts as published as soon as WordPress has the draft.

## Set a category

All posts from one outlet go into a single category. **Default category** requires the category's ID number, not its name. If you enter a name, WordPress ignores it without an error and falls back to its default category.

To find the ID number, open **Posts** and then **Categories** in WordPress and click the category you want. Look at the address bar for something like `tag_ID=12`, then type `12` into **Default category**.

You can't pick a different category per article. If you need several categories, connect the same site more than once, giving each outlet its own **Default category** and a clear name like "Blog: Guides".

## Why does the connection test fail?

If you see "Could not connect to WordPress. Check the URL, username, and application password.", Unspar couldn't log in and read posts. Check these four things:

1. Open the **WordPress REST API URL** in your browser. You should see code-like text (JSON). If you see your homepage or an error page instead, something on your site is blocking the REST API.
2. Check your **Username**. Make sure it's the name you use to sign in to WordPress.
3. Make sure you pasted the application password, not your regular password.
4. Check your security plugin and your host. Some block the REST API or disable application passwords.

## Why does publishing fail after a good test?

If the user doesn't have permission to publish posts, WordPress refuses the post. Give that user the Editor or Administrator role.

Sometimes a security or caching plugin responds instead of WordPress. When that happens, Unspar reports "WordPress answered 200 without a post id" and shows "Unknown publish outcome", because the post might still have been created. Check your site before publishing again. [Troubleshooting](https://www.unspar.com/docs/guides/troubleshooting/) explains what to do next.

If you revoke the application password in WordPress, publishing will fail until you enter a new one. Open [Outlets](https://app.unspar.com/outlets), click the outlet's name, paste the new password into **Password**, and choose **Save**.

## Update posts that are already on your site

Unspar can also pull in posts that are already on your WordPress site, refresh them, and write the updated version back to the same post. This is the only time Unspar changes a post after publishing. See [Refresh an article](https://www.unspar.com/docs/guides/refresh/).

## For AI agents

You set up WordPress outlets in the web app. An agent can find the outlet, test it and publish an article to it after a person has read the article.

```sh
unspar outlets list --jq '.[] | select(.provider_type == "wordpress")'
unspar outlets show <outlet-id>
unspar api post /outlets/<outlet-id>/test
unspar articles publish <article-id> --outlet <outlet-id>
```
