SwitchFromWP

How to Export WordPress Content for a Lovable Rebuild: WXR, REST API, WP-CLI and Media

What each WordPress export method includes and leaves out, how to get your images and SEO fields out, and what to do about page builders, shortcodes and custom fields.

Written by a Certified Lovable ExpertFacts checked 25 November 20264 min read

This page recommends Lovable and contains partner links. If you sign up through one I may earn a commission, at no extra cost to you. Disclosure.

The short answer

Use Tools > Export (a WXR file) for posts, pages, categories, tags and custom fields, but download the wp-content/uploads folder separately, because the WXR file only references images, it doesn't contain them. For anything structured (custom post types, ACF fields, SEO titles) the WordPress REST API or a database export gives you cleaner data. Never paste page-builder markup into the new site: extract the text and images and rebuild the layout in Lovable.

The four export methods compared

MethodGood forDoes not include
Tools > Export (WXR)Posts, pages, custom post types, comments, custom fields, categories, tags, menus and authors, in one XML file.The actual image and file binaries; site settings; theme and plugin settings; most page-builder rendering.
REST API (/wp-json/wp/v2/)Clean JSON of posts, pages, media records, categories, tags. Rendered HTML per post. SEO plugin fields where exposed.Private content without authentication; fields not registered for REST.
WP-CLI (wp export, wp db export)Large sites; repeatable exports; full database dumps.WXR via CLI still excludes attachment files and site configuration.
Hosting backup / SFTPThe wp-content/uploads media folder and a full database copy.Nothing structured; you still need to extract content from it.

Official guidance

WordPress's own documentation lists what Tools > Export includes. WP-CLI's documentation states that WXR export does not include site configuration or the attachment files themselves. An 'attachment' in the WXR file is a record pointing at the image, not the image. See Tools Export and wp export.

Using Tools > Export properly

  1. 01

    Go to Tools > Export

    Choose 'All content' for a complete file, or export Posts, Pages and each custom post type separately for easier handling.

  2. 02

    Download the file

    It's an XML file. For large sites it can be several megabytes; that's normal.

  3. 03

    Check it opened

    Open it in a text editor and search for one of your post titles. If it's empty or cut short, the host may have timed out: use WP-CLI or export in smaller date ranges.

Lovable can work from this file: upload it, or the specific pages you need, and ask for the content to be turned into pages or posts in the new site's structure. Check every imported page against the original; don't assume.

Using the REST API for clean, structured data

Most WordPress sites expose a public read-only API. Open these in a browser on your own site:

Public REST endpoints (replace example.com)
https://example.com/wp-json/wp/v2/posts?per_page=100&page=1
https://example.com/wp-json/wp/v2/pages?per_page=100&page=1
https://example.com/wp-json/wp/v2/media?per_page=100&page=1
https://example.com/wp-json/wp/v2/categories?per_page=100
https://example.com/wp-json/wp/v2/tags?per_page=100
  • per_page maxes out at 100. The response headers X-WP-Total and X-WP-TotalPages tell you how many pages to request.
  • Each post includes slug, date, modified, title.rendered, content.rendered, excerpt.rendered, featured_media, categories and tags. The slug is what you need to keep URLs identical.
  • With Yoast active, posts include a yoast_head_json object holding the SEO title, description, canonical and Open Graph data.
  • ACF fields appear in an acf object only if 'Show in REST API' is enabled on the field group.
  • If /wp-json/ returns a 404, permalinks may be set to 'Plain', or a security plugin is blocking the API. Try ?rest_route=/wp/v2/posts.

In Lovable

If you want WordPress to keep holding the content while Lovable builds the front end, Lovable's self-hosted WordPress connector reads posts, pages, media and users through this same REST API. Your site needs WordPress 5.6+, HTTPS, pretty permalinks, and an Application Password. See Lovable WordPress integration.

Getting your images and files out

WordPress stores uploads under wp-content/uploads/YYYY/MM/. Each image usually has several resized copies (for example photo-300x200.jpg, photo-1024x683.jpg) alongside the original.

  1. Download the whole uploads folder by SFTP or the host's file manager (zip it on the server first if you can).
  2. Work from originals, not the resized copies, when rebuilding.
  3. Identify what's actually used: cross-reference images referenced in post content and featured images (from the REST API or WXR) against the folder. Media libraries usually contain plenty of unused files.
  4. Keep PDFs and downloads that other sites link to. Either keep the same path on the new site or redirect the old file URL.
  5. Carry across alt text. It's stored on the attachment record (alt_text in the REST media endpoint), not in the image file.

Extracting Yoast or Rank Math SEO fields

Your custom titles and meta descriptions are worth keeping where they were deliberately written. They live in post meta:

PluginTitle fieldDescription field
Yoast SEO_yoast_wpseo_title_yoast_wpseo_metadesc
Rank Mathrank_math_titlerank_math_description

These are in the WXR file (as wp:postmeta entries) and in a database export (wp_postmeta table). Yoast titles may contain template variables like %%title%% %%sep%% %%sitename%%: those need resolving to real text. The yoast_head_json REST field already gives you the resolved values.

Page builders, shortcodes and blocks

This is where exports disappoint people. What you see on the page is often not what's stored:

  • Shortcodes like [contact-form-7 id="12"] or [gallery] are stored as text and only become content when the plugin runs. In an export they're just the bracketed code.
  • Elementor stores its layout as JSON in post meta (_elementor_data); the post content field may hold only a fallback copy.
  • Divi and WPBakery store layouts as nested shortcodes in the post content.
  • Gutenberg blocks are stored as HTML with <!-- wp:... --> comments. This is the cleanest of the lot.

The reliable approach: take the text and images from the rendered page (content.rendered in the REST API, or the live page itself), and rebuild the layout in Lovable. Don't try to convert builder markup.

What not to copy into the new site

  • User accounts and password hashes. If the new site needs logins, invite users to set a new password.
  • Customer or order personal data, unless the new site genuinely needs it and you've planned how it's protected.
  • API keys, licence keys or credentials from wp-config.php or plugin settings.
  • Spam comments, revisions and auto-drafts.
  • Tracking scripts nobody can explain.

With your content exported, start rebuilding in Lovable and plan your URLs with the redirects and SEO guide.

Ready to build the new site?

Start a Lovable project and rebuild privately before you touch your live domain.

Start on Lovable
QR code linking to Lovable with the partner linkScan to try LovableOr tap the code on mobile

Sources checked for this guide

Product and search behaviour changes. These were checked on 25 November 2026; follow the live pages for current details.

Read next