Skip to content

Guide

Migrate WordPress posts and pages to LyEve

Move every published WordPress post and page into LyEve with its title, slug, HTML, excerpt and publish date. A Python script turns the export into JSON.

On this page

Every published post and page on a WordPress site can become a LyEve entry with its title, slug, HTML, excerpt and publish date. The Content API then serves it to whatever front end you build.

You export the site from WordPress and create two content types from WordPress's own post types. A short Python script turns the export into JSON, and bulk import loads it. The content type import and bulk import are free on every LyEve install.

LyEve Console and the engine's API are two routes through the same steps to the same entries. We took both on November 11, 2026, with WordPress 7.1.4, the LyEve engine v0.62.0 and admin console v0.28.0.

What comes across, and what stays behind

Comes across Stays behind
Published posts and pages Drafts, pending, private and trashed items
Title, slug, excerpt and publish date Comments, categories, tags and authors
The content, as HTML Custom fields, including Advanced Custom Fields
Links and image tags in the content The image files and other uploads

A few details decide how the content looks afterward:

  • Images keep their addresses on your WordPress server, so they load only while that server is up. Move the files before you turn it off.
  • Shortcodes such as [caption] and [gallery] stay as plain text, because WordPress expands them only when it shows a page.
  • The block editor's markers, such as <!-- wp:paragraph -->, are removed on import. The HTML between them stays.
  • Nothing here moves themes, plugins, widgets or settings, because a WordPress export does not hold them.

What you need

Console v0.28.0

  • A running LyEve install with its console, and the email and password of its first account, the super admin. Run the engine and the console together starts both with Docker, with the console on http://localhost:8080.
  • Python 3 on your computer. The script in step 4 uses only Python's standard library.

Engine API v0.62.0

  • A running LyEve install, and the email and password of its first account, the super admin. The quickstart starts one with Docker. The commands below use its addresses: the Admin API on http://localhost:3001 and the Content API on http://localhost:3002.
  • curl, jq and Python 3 on your computer. The script in step 4 uses only Python's standard library.

Either way, you also need an administrator account on the WordPress site. The LyEve install may run on PostgreSQL, MySQL or SQL Server, and Supported databases lists the versions.

Make a new folder for the move, and run every command from it.

1. Export the site from WordPress

In the WordPress dashboard, open Tools, then Export. Leave All content selected and choose Download Export File.

WordPress saves an XML file named after the site and the day, such as fieldnotes.WordPress.2026-11-11.xml. Move it into your folder. If you run WP-CLI on the server, wp export writes the same kind of file.

2. Sign in to LyEve

Console v0.28.0

Open the console's address, such as http://localhost:8080, and sign in with your email address and password.

Engine API v0.62.0

Shell
export TOKEN=$(curl -s -X POST http://localhost:3001/api/admin/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com", "password": "your-password"}' | jq -r .token)

Use your own email address and password. The token lasts 15 minutes. When a later command answers authentication required, run this one again.

3. Create the content types

WordPress has no schema file to export. LyEve's WordPress import reads WordPress's post types instead, and this guide needs two of them: posts and pages.

Console v0.28.0

Open Schema builder, choose Import and export, then Import. Set Where the definitions come from to WordPress (an ACF field-group export). The same choice reads WordPress's post types.

Paste this into Or paste the definitions:

JSON
{"post": {"slug": "post", "name": "Posts"}, "page": {"slug": "page", "name": "Pages"}}

Choose Check. The drawer lists page and post, each marked Creates. Nothing is written yet.

The Import content types drawer in the console, with WordPress chosen as the source, the post types pasted, and page and post each marked Creates. The check, before anything is written.

Choose Import to create them. The console confirms with "Imported 2 content types".

Engine API v0.62.0

Save the entries for posts and pages that WordPress lists, with your site's address in place of your-site.example:

Shell
curl -s "https://your-site.example/?rest_route=/wp/v2/types" | jq '{post, page}' > wp-types.json

The ?rest_route= form of the address works whatever your permalink setting is.

Ask LyEve what it would create from that file. Nothing is written yet:

Shell
curl -s -X POST "http://localhost:3001/api/admin/schemas/import?from=wordpress" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  --data-binary @wp-types.json | jq '{applied, schemas: [.plan.schemas[] | {name, action}]}'
JSON
{
  "applied": false,
  "schemas": [
    {
      "name": "page",
      "action": "create"
    },
    {
      "name": "post",
      "action": "create"
    }
  ]
}

Both should say create. Send the same file again with apply=true to create them:

Shell
curl -s -X POST "http://localhost:3001/api/admin/schemas/import?from=wordpress&apply=true" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  --data-binary @wp-types.json | jq '{applied, schemas: [.plan.schemas[] | {name, action}]}'

The answer is the same, with "applied": true.

LyEve now has the content types post and page, shown as Posts and Pages in the console. Each has the fields every WordPress post has:

Field Type Holds
title text, required The title
slug text, unique The slug, such as whats-growing
content rich text The content, as HTML
excerpt text The excerpt, when one was written
published_at date and time The publish date, in UTC

Each type also keeps draft and publish beside these fields. The check notes that only WordPress's publish maps to published, and every other status to a draft.

4. Turn the export into JSON

Save this as wxr-to-json.py in your folder:

Python
"""Turn a WordPress export file into posts.json and pages.json for LyEve."""
import json
import re
import sys
import xml.etree.ElementTree as ET

NS = {
    "wp": "http://wordpress.org/export/1.2/",
    "content": "http://purl.org/rss/1.0/modules/content/",
    "excerpt": "http://wordpress.org/export/1.2/excerpt/",
}
BLOCK_TAG = re.compile(r"<(p|h[1-6]|ul|ol|blockquote|pre|table|figure|div)[\s>]", re.I)


def read(item, tag):
    return (item.findtext(tag, "", NS) or "").strip()


def paragraphs(html):
    # The classic editor saves blank lines, and WordPress adds the <p> tags
    # only when it shows a page. Block editor content already has them.
    if "<!-- wp:" in html or re.search(r"<p[\s>]", html):
        return html
    parts = [p.strip() for p in re.split(r"\n\s*\n", html) if p.strip()]
    return "\n".join(
        p if BLOCK_TAG.match(p) else "<p>" + p.replace("\n", "<br>\n") + "</p>"
        for p in parts
    )


entries = {"post": [], "page": []}
for item in ET.parse(sys.argv[1]).iter("item"):
    kind = read(item, "wp:post_type")
    if kind not in entries or read(item, "wp:status") != "publish":
        continue
    entries[kind].append({
        "title": read(item, "title"),
        "slug": read(item, "wp:post_name"),
        "content": paragraphs(read(item, "content:encoded")),
        "excerpt": read(item, "excerpt:encoded"),
        "published_at": read(item, "wp:post_date_gmt").replace(" ", "T") + "Z",
        "entry_status": "published",
    })

for kind, rows in entries.items():
    with open(kind + "s.json", "w", encoding="utf-8") as out:
        json.dump(rows, out, ensure_ascii=False, indent=2)
    print(kind + "s.json:", len(rows))

Run it on your export:

Shell
python3 wxr-to-json.py fieldnotes.WordPress.2026-11-11.xml
posts.json: 3
pages.json: 2

The counts are your site's published posts and pages. The script keeps the posts and pages whose status is publish, and reads each one's title, slug, content, excerpt and publish date. Posts written in the classic editor get their <p> tags here, because WordPress adds them only when it shows a page. entry_status marks each entry as published rather than a draft.

Steps 5 and 6 load these two files, in the console or with the API.

5. Check the files with a dry run

Console v0.28.0

Open Insight, then Imports, and choose New import. Upload posts.json, set Content type to post, and choose Read the file.

The console shows the first rows and maps each column to the field of the same name. Make three changes:

  • Set Entry status to entry_status.
  • Under When an entry already exists, choose Create and update.
  • Set Key field to slug.

The mapping step of New import in the console, with Entry status set to entry_status, Create and update chosen, and slug as the key field. The mapping for posts.json, with the three changes made.

Entry slug and Entry status set the entry's own slug and status, which LyEve keeps beside its fields. With Create and update and the key slug, importing again updates the entries it finds by slug instead of adding copies.

Choose Dry run, which checks every row and writes nothing. For the example site it reports 3 rows in the file, 3 that would import and 0 that would be rejected.

The Check step of New import, reporting 3 rows in the file, 3 that would import and 0 that would be rejected. The dry run for posts.json: every row passes.

Go on when Would be rejected is 0, and leave the drawer open for step 6. When a step fails covers the errors WordPress content produces.

Engine API v0.62.0

Define a small shell function that builds the import request for one file. It names the content type, carries the file, and maps each key in the file to a field:

Shell
build_request() {
  local src=${2:-$1s.json}
  jq -n --arg type "$1" --arg name "$src" --rawfile file "$src" '{
    content_type: $type,
    source_name: $name,
    file_data: ($file | @base64),
    mode: "upsert",
    upsert_key: "slug",
    field_mappings: [
      {source_field: "title", target_field: "title", required: true},
      {source_field: "slug", target_field: "slug"},
      {source_field: "slug", target_field: "entry.slug"},
      {source_field: "content", target_field: "content"},
      {source_field: "excerpt", target_field: "excerpt"},
      {source_field: "published_at", target_field: "published_at"},
      {source_field: "entry_status", target_field: "entry.status"}
    ]
  }' > "import-${src%.json}.json"
}

for type in post page; do build_request "$type"; done

build_request post reads posts.json and writes the request to import-posts.json.

entry.slug and entry.status set the entry's own slug and status, which LyEve keeps beside its fields. With mode set to upsert and upsert_key to slug, running the import again updates the entries it finds by slug instead of adding copies.

Send both requests to the dry run, which checks every row and writes nothing:

Shell
for type in post page; do
  curl -s -X POST http://localhost:3001/api/admin/imports/validate \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    --data-binary @import-${type}s.json
done
{"total_rows":3,"valid_rows":3,"error_rows":0,"errors":[]}
{"total_rows":2,"valid_rows":2,"error_rows":0,"errors":[]}

Go on when error_rows is 0 for both. When a step fails covers the errors WordPress content produces.

6. Import

Console v0.28.0

Choose Import 3 rows, which names your file's count. The drawer closes, and the import appears under History.

Choose New import again for pages.json, with the content type page and the same three changes as in step 5. Check it with Dry run, then import it.

History lists each import with what it wrote. Both say Every row imported, and Created matches the counts the script printed. The newest import is listed first.

The Imports screen in the console, with the posts.json and pages.json imports listed under History. Both imports on the console's Imports screen, under Insight.

Engine API v0.62.0

Send the same requests to the import route:

Shell
for type in post page; do
  curl -s -X POST http://localhost:3001/api/admin/imports \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    --data-binary @import-${type}s.json | jq -c '{content_type, status, total_rows}'
done
{"content_type":"post","status":"pending","total_rows":3}
{"content_type":"page","status":"pending","total_rows":2}

The rows are written in the background. List your imports to see how each one ended:

Shell
curl -s http://localhost:3001/api/admin/imports \
  -H "Authorization: Bearer $TOKEN" \
  | jq -c '.jobs[] | {content_type, status, inserted_rows, updated_rows, errored_rows}'
{"content_type":"page","status":"completed","inserted_rows":2,"updated_rows":0,"errored_rows":0}
{"content_type":"post","status":"completed","inserted_rows":3,"updated_rows":0,"errored_rows":0}

The newest import is listed first. If one still says pending or running, run the command again in a moment.

7. Read a post back

Console v0.28.0

Open Content, then Posts, and choose a post. The editor shows its title, slug, content, excerpt, status and publish date, as WordPress gave them.

An imported post open in the console, with its title, slug, content, excerpt, status and publish date filled in from WordPress. An imported post in the editor, with the fields WordPress gave it.

The content keeps its paragraphs, headings and lists.

Engine API v0.62.0

Ask the Content API for one post by its slug, using a slug from your site. The -g flag stops curl from reading the square brackets as a pattern:

Shell
curl -s -g "http://localhost:3002/api/v1/content/post?filters[slug]=whats-growing" \
  -H "Authorization: Bearer $TOKEN" | jq '.[0].data | {title, slug, excerpt, published_at}'
JSON
{
  "title": "What's growing in the garden",
  "slug": "whats-growing",
  "excerpt": "Tomatoes and basil, planted on Saturday.",
  "published_at": "2026-09-20T09:30:00+00:00"
}

The HTML is in content. Print its first lines on their own:

Shell
curl -s -g "http://localhost:3002/api/v1/content/post?filters[slug]=whats-growing" \
  -H "Authorization: Bearer $TOKEN" | jq -r '.[0].data.content' | grep -v '^$' | head -3
HTML
<p>The first tomatoes went in on Saturday. Here is what we planted and why.</p>
<h2 class="wp-block-heading">What went in</h2>
<ul class="wp-block-list">

The block markers are gone, and the classes the block editor wrote stay on the tags.

Check that it worked

Console v0.28.0

  • History on the Imports screen says Every row imported for both files, and Created matches the counts the script printed.
  • Content, then Posts and Pages, lists every entry the script wrote.

The Posts list in the console, showing the imported posts with columns for slug, content, excerpt, status and publish date. Content, then Posts: every post the script wrote.

Engine API v0.62.0

  • The import list in step 6 shows completed for both content types, with inserted_rows equal to the counts the script printed.
  • LyEve holds every entry the script wrote. The Admin API counts them in total_count, however many there are:
Shell
for type in post page; do
  curl -s "http://localhost:3001/api/admin/content?schema=$type&limit=1" \
    -H "Authorization: Bearer $TOKEN" | jq .total_count
done
3
2

Then open two or three posts beside their WordPress originals and compare them. Include one with images and one with code samples or unusual characters.

When a step fails

Find what you see under the way you followed the guide, and open it for the fix.

Console v0.28.0

The check in step 3 marks a content type Changes

If you already imported these definitions, that is expected, and importing them again changes nothing.

Otherwise LyEve already has a content type with that name, such as the post the quickstart creates. Importing would give it WordPress's fields and remove the others. Paste these definitions instead, which use new names:

JSON
{"blog_post": {"slug": "post", "name": "Posts"}, "blog_page": {"slug": "page", "name": "Pages"}}

In steps 5 and 6, choose the content types blog_post and blog_page.

The dry run in step 5 rejects a row: "The field title is required."

WordPress publishes a post with no title, and the post content type requires one. The dry run lists the row's number in the file, counting from 1. Give that post a title in WordPress, then export and convert again.

"The file is larger than the 50 MB an import takes. Split it and import the parts." in step 5, after Read the file

Bulk import takes up to 100,000 rows and 50 MiB per file. Split the file into parts of 2,000 entries, which this writes as posts-1.json, posts-2.json and so on:

Shell
python3 - <<'EOF'
import json

rows = json.load(open("posts.json", encoding="utf-8"))
for n, start in enumerate(range(0, len(rows), 2000), 1):
    with open(f"posts-{n}.json", "w", encoding="utf-8") as out:
        json.dump(rows[start:start + 2000], out, ensure_ascii=False)
EOF

Import each part as in steps 5 and 6, with the content type post and the same three changes.

Engine API v0.62.0

authentication required

The token expired. Run step 2 again.

jq: parse error: Invalid numeric literal in step 3

Your site answered with a web page instead of JSON, which some security plugins do. Write wp-types.json yourself, with this content, and go on:

JSON
{"post": {"slug": "post", "name": "Posts"}, "page": {"slug": "page", "name": "Pages"}}
The dry run in step 3 says update

If you already applied this file, that is expected, and applying it again changes nothing.

Otherwise LyEve already has a content type with that name, such as the post the quickstart creates. Applying the plan would give it WordPress's fields and remove the others. Use new names instead.

In step 3, save the post types under the new names:

Shell
curl -s "https://your-site.example/?rest_route=/wp/v2/types" | jq '{blog_post: .post, blog_page: .page}' > wp-types.json

In step 5, change the line content_type: $type, in build_request to this:

    content_type: ("blog_" + $type),

In step 7, read from /api/v1/content/blog_post in place of /api/v1/content/post.

required field 'title' is missing or empty in step 5

WordPress publishes a post with no title, and the post content type requires one. The error names the row in row_index, which counts from 0 in the file. Give that post a title in WordPress, then export and convert again.

Request body exceeds the 70953644 byte limit. in step 5

Bulk import takes up to 100,000 rows and 50 MiB per file. Split the file into parts of 2,000 entries, which this writes as posts-1.json, posts-2.json and so on:

Shell
python3 - <<'EOF'
import json

rows = json.load(open("posts.json", encoding="utf-8"))
for n, start in enumerate(range(0, len(rows), 2000), 1):
    with open(f"posts-{n}.json", "w", encoding="utf-8") as out:
        json.dump(rows[start:start + 2000], out, ensure_ascii=False)
EOF

Build and check a request for each part. Run this in the same terminal as step 5, so build_request is still defined:

Shell
for part in posts-*.json; do
  build_request post "$part"
  curl -s -X POST http://localhost:3001/api/admin/imports/validate \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    --data-binary @"import-${part%.json}.json"
done

build_request post sends each part as the content type post. When error_rows is 0 for every part, import them:

Shell
for part in posts-*.json; do
  curl -s -X POST http://localhost:3001/api/admin/imports \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    --data-binary @"import-${part%.json}.json" | jq -c '{content_type, status, total_rows}'
done

Next: an API key for your front end

Your content is in LyEve, and your front end reads it from the Content API. Give the front end a key of its own, never an account's sign-in: API keys.