Headless WordPress · Lesson 18 of 22 · 15 min

Run WordPress on your computer

Start a free local WordPress site in one command with WordPress Playground and add Sunday Supper's content.

You need a WordPress site to pull from. WordPress Playground runs a full WordPress on your laptop with one command. No database, no hosting, no account.

Already have a WordPress site you can practice on? Skip to “Test the API” and use its URL instead.

1. Start WordPress

Open a new terminal (keep your Astro one separate) and run:

mkdir sunday-supper-wp
cd sunday-supper-wp
npx @wp-playground/cli@latest start --no-login

When it says Ready! WordPress is running on http://127.0.0.1:9400, open that address. That’s a real WordPress site.

The site is saved between restarts, so your posts stick around. Stop it with Ctrl + C and run the same command to start it again. Add --reset if you ever want a fresh site.

2. Sign in

Go to http://127.0.0.1:9400/wp-admin and sign in:

  • Username: admin
  • Password: password

These are Playground’s defaults. Fine for a local practice site, never for a real one.

3. Add the content

Posts. Go to Posts. Trash the “Hello world!” post. Then click Add New Post and recreate the three Sunday Supper posts from lesson 11 (copy the text from your Markdown files). For each one:

  • Paste the title and body
  • In the right sidebar, under Excerpt, paste the description
  • Add a Category like “Menu” or “Tips”
  • Set a Featured image (any food photo you have)
  • Click Publish

About page. Go to Pages → Add New Page. Title it “About” and paste the About text from about.md. In the sidebar, check the Slug (sometimes shown as the URL) is about. Publish.

4. Test the API

Open these in your browser:

http://127.0.0.1:9400/wp-json/wp/v2/posts
http://127.0.0.1:9400/wp-json/wp/v2/pages?slug=about

You should see your posts and your About page as JSON.

Your setup from here on

You’ll have two terminals running while you work:

Terminal Command Address
WordPress npx @wp-playground/cli@latest start --no-login 127.0.0.1:9400
Astro npm run dev localhost:4321