Troubleshooting
Common issues and how to fix them.
WordPress / GraphQL
GraphQL endpoint returns 404
Symptoms: http://localhost/headleespro/graphql not found
Fixes:
- Ensure WPGraphQL plugin is installed and activated
- Go to Settings → Permalinks and click Save (flushes rewrite rules)
- Verify Apache/nginx rewrite rules allow
/graphql
GraphQL returns empty themeSettings
Symptoms: Next.js shows mock data even with WP running
Fixes:
- Activate HeadlessCore theme
- Check
NEXT_PUBLIC_WORDPRESS_API_URLends with/graphql - Open browser DevTools → Network → verify GraphQL POST returns 200
CORS errors in browser
Symptoms: Access-Control-Allow-Origin error when fetching GraphQL from browser
Note: HeadlessCore fetches GraphQL server-side only. If you see CORS errors, you may be calling GraphQL from client components — move fetches to Server Components or API routes.
For client-side GraphQL (not recommended), install a CORS plugin or configure your web server.
Next.js / Frontend
Site shows mock data only
Symptoms: Homepage says "Local Mock Mode Active"
Fixes:
- Create
nextjs-starter-kit/.env.localfrom.env.example - Set
NEXT_PUBLIC_WORDPRESS_API_URL=http://localhost/headleespro/graphql - Restart
npm run dev - Ensure XAMPP/Apache is running
Build fails with TypeScript errors
cd nextjs-starter-kit
npm run build
Read the error file and line. Common causes:
- Missing env vars (build should still pass with mock fallback)
- Import errors after custom edits
Images not loading
Symptoms: Broken images from WordPress
Fixes:
- Add your WordPress host to
next.config.ts→images.remotePatterns - Set
NEXT_PUBLIC_WORDPRESS_URLcorrectly - Use
SafeImagecomponent (falls back to placeholder on error)
Wrong homepage layout
Symptoms: Expected blog but see demo showcase
Fix: Headless Core → Settings → Home Page Layout → choose mode → Save. Wait for revalidation or hard-refresh.
Revalidation / Cache
Content not updating after publish
Symptoms: Edited post in WP but Next.js shows old content
Checklist:
headlesscore_nextjs_urlin WP = your Next.js URL (no trailing slash issues)REVALIDATION_SECRETin.env.localmatches WP admin Revalidation Secret- WordPress can reach Next.js URL (firewall, localhost vs production)
- Test manually:
curl -X POST http://localhost:3000/api/revalidate \
-H "Content-Type: application/json" \
-d '{"secret":"YOUR_SECRET","path":"/blog","tag":"posts"}'
Local dev note: WordPress on XAMPP cannot POST to localhost:3000 if Next.js isn't running. Start npm run dev first.
401 on revalidation
Secret mismatch. Regenerate and sync:
openssl rand -base64 32
Set same value in WP admin and .env.local, restart Next.js.
Preview mode
Preview link shows 401
PREVIEW_SECRET in Next.js doesn't match WordPress Preview Secret.
Preview shows published content, not draft
- Set
WORDPRESS_AUTH_TOKENin.env.local(JWT from WPGraphQL login) - Ensure WPGraphQL JWT Authentication plugin is active
- Verify draft mode banner appears (yellow bar at top)
Contact form
Form submits but no email
- Check WordPress
admin_emailin Settings → General - Configure SMTP plugin if host blocks
wp_mail() - Check Headless Core → Contact Submissions — logs are always saved
Webhook not firing
- Set Contact Webhook URL in Headless Core settings
- Use Slack incoming webhook or Discord webhook URL
- Test with a manual POST to verify URL is valid
Shop / Products
Shop page shows mock products only
- Create items under Headless Core → Shop Products
- Set price meta field
- Publish products
- Verify GraphQL:
{ headlessProducts { nodes { title productPrice } } }
WooCommerce products not appearing
Install WPGraphQL for WooCommerce plugin. Shop page calls getShopProducts() as fallback when headlessProducts is empty.
Docker
docker compose up fails
- Ensure ports 8080/3306 are free
- Run
docker compose down -vto reset volumes - Check Docker Desktop is running (Windows/Mac)
Theme changes not reflected
Volume mount should map ./wp-content/themes/wp-headless-theme. Restart container after theme file changes.
CLI
Template not found
Run from HeadlessCore repository root, or:
npm run sync:template
Getting help
- Check Architecture for data flow
- Check Content Model for CPT/field reference
- Run
npm test && npm run buildto verify codebase health - Check WP dashboard HeadlessCore Status widget for connection health