Getting Started
Get up and running with Headless Bridge in 5 minutes
Step 1: Install the Plugin
Option A: Via WordPress Admin
- Download the plugin from WordPress.org
- Go to Plugins → Add New → Upload Plugin
- Upload the ZIP file and click Activate
Option B: Via WP-CLI
wp plugin install headless-bridge --activate
Step 2: Verify Installation
- Go to Headless Bridge → Dashboard
- You should see:
- ✅ Cache Statistics (initially 0 entries)
- ✅ API Endpoints section
- ✅ Quick Actions buttons
Step 3: Create Test Data
Option A: Via WP-CLI (Recommended)
cd wp-content/plugins/headless-bridge wp eval-file test-helper.php create 5
Option B: Via WordPress Admin
- Create a few posts manually
- Go to Headless Bridge → Dashboard
- Click "Recompile All Content"
Step 4: Test the API
Your API is available at:
https://yoursite.com/wp-json/bridge/v1
Test with cURL
# List all posts curl 'https://yoursite.com/wp-json/bridge/v1/pages?type=post&limit=5' # Get a specific page curl 'https://yoursite.com/wp-json/bridge/v1/page?slug=hello-world'
Or visit in your browser
https://yoursite.com/wp-json/bridge/v1/pages?type=post
Step 5: Generate an API Key (For Previews)
- Go to Headless Bridge → API Keys
- Click "Generate New API Key"
- Copy the key (shown only once!)
- Test preview access:
curl -H "X-Headless-Bridge-Key: YOUR_KEY_HERE" \ 'https://yoursite.com/wp-json/bridge/v1/page?slug=draft-post&preview=true'
Frontend Integration Example
Here's a simple Next.js example:
// .env.local
NEXT_PUBLIC_WP_API_URL=https://yoursite.com/wp-json
// lib/wordpress.ts
export async function getPage(slug: string) {
const res = await fetch(
`${process.env.NEXT_PUBLIC_WP_API_URL}/bridge/v1/page?slug=${slug}`,
{ next: { revalidate: 3600 } }
);
return res.json();
}
// app/[slug]/page.tsx
export default async function Page({ params }) {
const data = await getPage(params.slug);
return (
<article>
<h1>{data.title}</h1>
<div dangerouslySetInnerHTML={{ __html: data.content }} />
</article>
);
}Expected Performance
After setup, you should see:
- API response time: < 100ms (cold)
- API response time: < 50ms (cached)
- Database queries per request: 1
- JSON size: ~5-20KB (depending on content)
Quick Troubleshooting
"API returns 404"
- Make sure the post is published (not draft)
- Check the slug is correct (case-sensitive)
- Verify permalinks are enabled: Settings → Permalinks → Select "Post name"
"Cache not populating"
- Check Dashboard → Queue Status
- Enable debug logging in
wp-config.php - Check
wp-content/debug.logfor errors
Next Steps
- Read the API Reference
- Learn about Next.js Integration
- Check out Troubleshooting
- Upgrade to Pro for ACF and webhooks