Build Phases
Phase 6 — Going Headless
Disable the WordPress frontend once your Next.js site is live.
Method A — Headless Mode Plugin (Recommended)
- Go to Plugins → Add New
- Search Headless Mode by WP Engine
- Install and Activate
Done. All WordPress frontend URLs now redirect to your Next.js site. /wp-admin and /wp-json keep working normally.
Method B — Manual Redirect
// functions.php
function redirect_frontend_to_nextjs() {
if (is_admin()
|| strpos($_SERVER['REQUEST_URI'], '/wp-json/') !== false
|| strpos($_SERVER['REQUEST_URI'], '/wp-login.php') !== false) { return; }
wp_redirect('https://yourdomain.com' . $_SERVER['REQUEST_URI'], 301);
exit;
}
add_action('template_redirect', 'redirect_frontend_to_nextjs');Use Method A unless you have a specific reason to do it manually. The plugin is maintained by WP Engine and handles edge cases like feed URLs and sitemaps automatically.
Verify After Going Headless
# REST API must still return JSON
curl https://cms.yourdomain.com/wp-json/wp/v2/posts | head -c 200
# WordPress frontend must redirect
curl -I https://cms.yourdomain.com/
# Expected: HTTP/2 301 -> https://yourdomain.com/Important Notes
| Thing | Status after going headless |
|---|---|
| WordPress frontend (themes) | Redirects to Next.js — visitors never see it |
/wp-admin | Still works — editors log in here as usual |
/wp-json | Still works — Next.js fetches from here |
/wp-login.php | Still works — needed for admin access |
| Active theme | Keep one active — WordPress requires it even headless |
Never delete the active theme. Even in headless mode WordPress requires an active theme to function. Keep Twenty Twenty-Four active — visitors will never see it.