Build Phases

Phase 6 — Going Headless

Disable the WordPress frontend once your Next.js site is live.

Method A — Headless Mode Plugin (Recommended)

  1. Go to Plugins → Add New
  2. Search Headless Mode by WP Engine
  3. 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

ThingStatus after going headless
WordPress frontend (themes)Redirects to Next.js — visitors never see it
/wp-adminStill works — editors log in here as usual
/wp-jsonStill works — Next.js fetches from here
/wp-login.phpStill works — needed for admin access
Active themeKeep one active — WordPress requires it even headless
TIP

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.

PreviousPhase 5 — ISR WebhooksNextPhase 7 — Domains