CoursesMigrating content from WordPress to SanityFirst steps
Track
Replatforming from a legacy CMS to a Content Operation System

Migrating content from WordPress to Sanity

Lesson
2

First steps

Harness the power of scripting content migrations into Sanity, fix past platform mistakes, and confidently handle unique content shapes and augmentations.

Log in to mark your progress for each Lesson and Task

The first step is assessing how you export content from your WordPress project. There are several ways to extract content from WordPress. In this course, you'll target the REST API.

The WordPress REST API is a core feature of WordPress and a predictable way to query public and private content directly from the source.

If you prefer to use the XML export tooling or WPGraphQL, you must modify the logic of the scripts written in this course.

Before proceeding, you must ensure that your current install allows access to the REST API. You may have a security plugin or other configuration that blocks access. A simple way to get around this is to run WordPress locally with a copy of your production database.

Typically, you can visit the REST API at the following route:

https://<your-domain-name>/wp-json/wp/v2

You should see a JSON response in your web browser, with the available routes to query content from:

The above is viewed in a Chromium-powered web browser with the JSON Formatter extension installed

To compare, some publicly available blogs which have an open REST API include:

https://ma.tt/wp-json/wp/v2
https://blog.ted.com/wp-json/wp/v2
https://finland.fi/wp-json/wp/v2
https://www.nasa.gov/wp-json/wp/v2
Find your WordPress installation's REST API URL

Once you've confirmed your WordPress installation has an open API URL, you can get started.

Courses in the "Replatforming from a legacy CMS to a Content Operation System" track