# WordPress Posts to WXR Export - Draft Import File (`bigjgpt/wordpress-posts-to-wxr`) Actor

Export authorised public posts from a self-hosted WordPress blog to a draft WXR import file. Includes categories, tags, featured-image references and a completeness report. Built for agency rebuilds when a native source export is unavailable.

- **URL**: https://apify.com/bigjgpt/wordpress-posts-to-wxr.md
- **Developed by:** [Junaid Hussain](https://apify.com/bigjgpt) (community)
- **Categories:** Developer tools, Integrations
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.20 / wxr export

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## WordPress Posts to WXR — Draft Import File

Move authorised public blog posts from a **self-hosted WordPress site** into a WordPress import file. Download the WXR, import it into your destination site, and review the resulting drafts before publishing.

Useful for agency rebuilds and content migrations when you have permission to copy the published content but cannot obtain a native source export. You need no source plugin, source login or locally installed exporter. You still need administrator access and the ordinary WordPress importer on the destination.

### Quick start

1. Run **Try the built-in example** to create three original demonstration posts. It contacts no website.
2. Choose **Export my blog posts**, enter the site's HTTPS homepage, and confirm you own the content or have permission to export it. Include the installation subfolder, such as `https://your-domain.example/blog/`, if needed.
3. Set the maximum number of posts. Start with 3 to inspect the result; each run supports up to 200.
4. Download **EXPORT.xml** and read **MANIFEST.json**. The report identifies the selected posts, missing metadata, unsupported content and whether the entire source collection was included.
5. On a backed-up staging destination, use **Tools → Import → WordPress**. Map posts to an existing author and choose to download attachments if required. Review the drafts, image results and source links before publishing.

The file contains standard WXR 1.2 data. It was tested with WordPress 6.8.3 and WordPress Importer 0.9.7. Compatibility with other importer versions is not guaranteed by that test.

### What is included

- Public standard blog posts, selected in ascending source ID order.
- Titles, slugs, rendered article HTML, excerpts and source publication dates in local time and GMT.
- Available embedded categories and tags, and supported featured-image attachment references.
- A structured report containing source URLs, observation time, source publication/modification times, omissions and limits.

Posts import as **drafts**. Source authors and user accounts are not recreated. The destination importer can change slugs where an existing post conflicts. WordPress Importer 0.9.7 replaces modification timestamps; the original values remain in the report, rather than being promised as the destination's last-modified dates.

### Scope and limitations

This is a public-post content export, not a full backup or website clone. WordPress.com, private/password-protected content, pages, custom post types, comments, users, themes, plugins, settings, SEO metadata and original block/page-builder editing data are outside scope. Restricted or redirected REST endpoints stop with an explicit error; there is no login or access-restriction bypass.

Rendered HTML remains source content. Posts with potentially active markup are skipped, not silently rewritten. Builder dependencies are flagged. Inline media and links can still reference the original site. Only approved featured raster-image URLs receive attachment entries; the Actor does not download image bytes. The destination downloads images during import, so its networking rules, source availability and permissions determine the outcome. A URL check during export cannot guarantee later availability. Review the report and destination before retiring a source site.

Hard limits per run: one site, 200 posts, 10 MB aggregate downloaded responses, 5 MB WXR, 1 MB report and 512 MB memory. Network work shares a 40-second deadline. A 60-second application stop timer begins after startup imports; container startup and shutdown can add platform-recorded runtime, so this is not a universal 60-second billing-duration guarantee. Individual post text limits are measured in UTF-8 bytes: 250,000 for content, 50,000 for an excerpt, 4,000 for a title and 1,000 for a slug. Each post allows up to 64 category IDs and 64 tag IDs. Oversized or malformed responses stop explicitly. A chosen post limit below the source total produces a labelled partial selection; it is not called a full export. There is no automatic continuation into further paid runs.

### Pricing

Pricing is **$0.02 per run start plus $0.20 for one saved, nonempty WXR export**, covering up to 200 selected posts. At the Actor's fixed 512 MB memory, one nonempty export run costs **$0.22 in Actor event charges**. The minimum accepted run charge ceiling is $0.22. Check the Pricing tab before running for the current applicable price.

The start charge applies to examples, empty sites and failed attempts. The built-in example and empty results have no export event, so their Actor event charge is $0.02. A usable nonempty file can contain explicit warnings or a limited selection and still counts as one export. No per-post, warning, dataset-row or separate API/model/proxy charge is added.

Resurrecting a finished run can generate another platform start event. A resumed completed export keeps the same file and does not request a second export event. Check Apify's charge settings before resurrecting; download an existing successful file directly when you only need the result again. Automatic restart on error is disabled by default.

If a billing response is uncertain, the Actor leaves the file available and reports `BILLING_REVIEW_REQUIRED`; it does not blindly retry the export charge.

### Output and automation

The default dataset contains one summary row. Run storage contains:

| Record | Purpose |
|---|---|
| `EXPORT.xml` | The draft WXR import file |
| `MANIFEST.json` | Source evidence, counts, omissions and completeness |
| `SUMMARY` | Small machine-readable result and billing status |
| `ERROR` | Bounded failure code, if a failure occurred |

Selected fields from an actual built-in example run's summary:

```json
{
  "status": "EXAMPLE",
  "mode": "example",
  "exportedPosts": 3,
  "importStatus": "draft",
  "billing": "EXAMPLE_NO_EXPORT_EVENT",
  "exportKey": "EXPORT.xml",
  "manifestKey": "MANIFEST.json"
}
```

Example input for a site you are authorised to export:

```json
{
  "mode": "export",
  "siteUrl": "https://your-domain.example/blog/",
  "maxPosts": 3,
  "rightsAcknowledged": true
}
```

Use the Actor's **API** tab for request examples. The Actor ID is `CKbm8KfMxpCgqTVSe`. For an automation or compatible agent client, use this workflow:

1. [Start a run](https://docs.apify.com/api/v2/actors-runs-post) with `POST /v2/actors/CKbm8KfMxpCgqTVSe/runs`, the JSON input above, and query options `maxTotalChargeUsd=0.22`, `memory=512` and `timeout=60`. Keep the returned `data.id` as your run ID.
2. [Poll that same run](https://docs.apify.com/api/v2/actor-run-get) at `GET /v2/actor-runs/{runId}` until it reaches `SUCCEEDED` or a terminal failure. Do not start another run just to check progress.
3. From that run's response, read `data.defaultKeyValueStoreId`. [Retrieve its records](https://docs.apify.com/api/v2/key-value-store-record-get) at `GET /v2/key-value-stores/{storeId}/records/{recordKey}`: read `SUMMARY` and `MANIFEST.json`, then download `EXPORT.xml`. Use `attachment=true` for the file download. Avoid “last run” endpoints, which can select a different concurrent run.

These paths use `https://api.apify.com`. Keep the API token in your secret environment and send it in the `Authorization: Bearer ...` header, never in a URL or source file. The Actor requests limited permissions and uses only its own run storage. Client discovery and agent execution depend on the integration you use; API availability alone does not establish either.

Treat Apify-generated signed output links as private: someone with a valid link may be able to download the file without signing in. Do not paste them into public issues or logs. [Apify documents signed-link access here](https://docs.apify.com/account/collaboration/general-resource-access#sharing-restricted-resources-with-pre-signed-urls). Download your files promptly; [run and unnamed-storage retention depends on your plan and settings](https://docs.apify.com/storage#data-retention).

### Data handling and support

Only export content you own or are authorised to copy; public access alone is not a licence. The Actor reads the supplied public REST endpoint and stores outputs in your Apify run. It does not build a shared content database, use an external model, or send content to another conversion service. Apify's storage and retention settings apply; delete your run/storage using Apify's controls when it is no longer needed. This is not a zero-retention service.

For a defect, open an Actor issue with the run ID, error code and a description of the expected result. Do not post credentials, private exports or client data publicly. Unsupported whole-site reconstruction or bespoke source-plugin fixes are not included.

This independent product is not affiliated with or endorsed by WordPress or Automattic.

# Actor input Schema

## `mode` (type: `string`):

Try the original three-post example, or export your authorised self-hosted WordPress blog. The example does not contact a website and has no export event charge; the run-start charge still applies.

## `siteUrl` (type: `string`):

Required for a real export. Enter the HTTPS homepage of a self-hosted WordPress site, including its installation subfolder if any. WordPress.com, private content and restricted APIs are unsupported.

## `maxPosts` (type: `integer`):

Export up to this many public posts, in source ID order. A limit below the source total is explicitly reported as a partial selection. Maximum 200; no automatic continuation.

## `rightsAcknowledged` (type: `boolean`):

Required for real website exports. Public visibility alone does not grant permission to copy a site's text or images. Not required for the built-in example.

## Actor input object example

```json
{
  "mode": "example",
  "maxPosts": 3,
  "rightsAcknowledged": false
}
```

# Actor output Schema

## `summary` (type: `string`):

No description

## `wxr` (type: `string`):

No description

## `manifest` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "mode": "example",
    "maxPosts": 3,
    "rightsAcknowledged": false
};

// Run the Actor and wait for it to finish
const run = await client.actor("bigjgpt/wordpress-posts-to-wxr").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "mode": "example",
    "maxPosts": 3,
    "rightsAcknowledged": False,
}

# Run the Actor and wait for it to finish
run = client.actor("bigjgpt/wordpress-posts-to-wxr").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "mode": "example",
  "maxPosts": 3,
  "rightsAcknowledged": false
}' |
apify call bigjgpt/wordpress-posts-to-wxr --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,bigjgpt/wordpress-posts-to-wxr"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/CKbm8KfMxpCgqTVSe/builds/ty5pzYA6Aa7jzjrf8/openapi.json
