WordPress Goes Headless With Our New Astro Integration
Engineering Integrations

WordPress Goes Headless With Our New Astro Integration

Brent Peterson | 3 min read

WordPress runs 40% of the web. Astro is one of the fastest-growing frontend frameworks. Until now, connecting them required either expensive third-party services or a lot of custom code.

We fixed that.

What We Built

Our RequestDesk WordPress plugin now includes a standalone Headless API. It exposes your WordPress content through clean REST endpoints designed specifically for modern frontend frameworks like Astro.

The key word is "standalone." You do not need a RequestDesk account to use this. Install the plugin, generate an API key, and your WordPress site becomes a headless CMS.

The Endpoints

Five endpoints cover everything you need:

  • GET /headless/posts - List posts with pagination, category filtering, tag filtering, search
  • GET /headless/posts/{slug} - Single post by slug with full content and SEO data
  • GET /headless/pages - List pages with parent/child hierarchy
  • GET /headless/pages/{slug} - Single page with children and template info
  • GET /headless/site - Site metadata, categories, and navigation menus

Each response includes SEO fields pulled from Yoast, RankMath, or All in One SEO. Your Astro site gets meta titles, descriptions, Open Graph data, and canonical URLs without extra work.

Why This Matters

Most headless CMS solutions fall into two camps: expensive SaaS platforms or complex self-hosted setups. If you already have content in WordPress, migrating to a headless CMS means re-entering everything or building migration scripts.

Our approach is different. Keep your content in WordPress. Keep using the editor your team knows. Just add a modern frontend.

The Astro Side

We also built a TypeScript client library that makes fetching WordPress content trivial:

import { getPosts, getPost, getSite } from "~/lib/wordpress";

// Get paginated posts
const { posts, pagination } = await getPosts({ page: 1, category: "news" });

// Get single post with full content
const { post } = await getPost("my-post-slug");

// Get site metadata and menus
const { site } = await getSite();

The library handles authentication, pagination, error handling, and TypeScript types. It works with Astro SSR mode out of the box.

Getting Started

  1. Install the RequestDesk Connector plugin on your WordPress site
  2. Go to RequestDesk > Headless API in the admin
  3. Generate an API key
  4. Add the key to your Astro project environment variables
  5. Start fetching content

The plugin is free. The Astro library is open source. Documentation is in the plugin admin panel.

What This Means for RequestDesk Users

If you are already using RequestDesk for content workflows, this integration means your approved content can flow directly to an Astro frontend. WordPress becomes your editing interface. Astro becomes your delivery layer. RequestDesk handles the workflow between them.

But again, you do not need RequestDesk to use the headless API. It works standalone.

What is Next

We are adding webhook support so Astro can rebuild pages automatically when WordPress content changes. We are also working on draft preview mode so editors can see unpublished content before it goes live.

If you have a WordPress site and want a faster frontend, try it out. The WordPress plugin and Astro client library are both on GitHub.

Tags

wordpress astro headless-cms integrations technical