Getting Started

WordPress Setup

Configure WordPress for WPNuxt
Don't have a WordPress site yet? See Local Development for setting one up locally.

Follow these steps to prepare your WordPress site for WPNuxt.

Step 1: Install WPGraphQL (Required)

WordPress doesn't expose a GraphQL API by default. WPGraphQL adds one, which WPNuxt uses to fetch your content with type safety and auto-generated composables.

  1. In WordPress Admin, go to Plugins → Add New
  2. Search for WPGraphQL or download it here
  3. Click Install Now, then Activate

Step 2: Configure WPGraphQL Settings

In WordPress Admin → GraphQL → Settings, configure:

SettingValueWhy
GraphQL Endpoint/graphqlDefault, matches WPNuxt config
Enable IntrospectionYesIntrospection lets WPNuxt query the GraphQL schema itself — discovering all available types, fields, and queries — so it can generate TypeScript types and validate your .gql files at build time. Without introspection enabled, pnpm nuxt prepare fails with a schema download error
Public IntrospectionYesRequired during development so WPNuxt can download the schema without authentication
Disable Public Introspection in production if your schema contains sensitive information. You have two options:
  1. Recommended: Set schemaAuthToken (or the WPNUXT_SCHEMA_AUTH_TOKEN env var) to a WPGraphQL authentication token. WPNuxt sends this as a Bearer token during build-time schema operations, so introspection works without being publicly exposed. See Securing Introspection below.
  2. Set downloadSchema: false and commit schema.graphql to your repository. You must manually update the schema file whenever your WordPress schema changes.
Permalinks: WPNuxt's URI-based composables (usePostByUri, useNodeByUri) require "pretty" permalinks. Go to Settings → Permalinks and select Post name or any non-plain structure. With "Plain" permalinks, WordPress returns no URI paths and these composables return null. See Troubleshooting for more details.
CORS: If WordPress and Nuxt run on different origins (common in local dev, e.g. WordPress on port 8080 and Nuxt on port 3000), you need to configure allowed origins in GraphQL → Settings → CORS. Add your Nuxt development URL to the allowed origins list. See Troubleshooting for details.

Step 3: Install WPGraphQL Content Blocks (Optional)

The standard GraphQL API returns post content as a single HTML string. This plugin exposes individual Gutenberg blocks as structured data, so @wpnuxt/blocks can render each block with its own Vue component.

Required only if you use @wpnuxt/blocks to render Gutenberg blocks as Vue components.

  1. Download from WPGraphQL Content Blocks
  2. In WordPress Admin, go to Plugins → Add New → Upload Plugin
  3. Upload the zip file and click Activate

This exposes block data in the GraphQL schema so @wpnuxt/blocks can render them.

Step 4: Install Headless Login for WPGraphQL (Optional)

WordPress authentication uses cookies tied to the WordPress domain. This plugin adds JWT-based authentication to WPGraphQL, enabling login flows from your Nuxt frontend.

Required only if you use @wpnuxt/auth for WordPress authentication.

  1. Download from Headless Login for WPGraphQL
  2. In WordPress Admin, go to Plugins → Add New → Upload Plugin
  3. Upload the zip file and click Activate

After installation, configure providers in WordPress Admin → GraphQL → Headless Login:

  1. Enable the Password provider for username/password authentication
  2. Optionally configure OAuth providers (Google, GitHub, etc.) for social login

See the Authentication Guide for detailed setup instructions.

Securing Introspection

By default, WPGraphQL exposes the schema publicly. This is fine during development, but in production you may want to disable Public Introspection to hide your schema from unauthenticated users.

WPNuxt supports authenticated schema introspection via the schemaAuthToken option. When configured, WPNuxt sends the token as a Bearer header during build-time operations (endpoint validation and schema download), allowing introspection to work without public access.

Setup

  1. In WordPress Admin, go to GraphQL → Settings
  2. Keep Enable Introspection set to Yes
  3. Set Public Introspection to No
  4. Generate an application password or authentication token for a WordPress user with sufficient permissions
  5. Add the token to your environment:
.env
WPNUXT_SCHEMA_AUTH_TOKEN=your-auth-token

Or set it directly in nuxt.config.ts:

nuxt.config.ts
wpNuxt: {
  wordpressUrl: 'https://wordpress.example.com',
  schemaAuthToken: process.env.WPNUXT_SCHEMA_AUTH_TOKEN
}
The schemaAuthToken is only used at build time for schema operations. It is never included in client bundles or runtime requests. For runtime authentication, use @wpnuxt/auth.

Verify Your Setup

Visit https://your-site.com/graphql in a browser. You should see the GraphQL IDE.

Try this query:

{
  posts {
    nodes {
      title
    }
  }
}

If you see your posts, WordPress is ready. Continue to Installation.

Summary

PluginRequired ForInstall Link
WPGraphQLAll WPNuxt projectsWordPress plugin directory
WPGraphQL Content Blocks@wpnuxt/blocks onlyGitHub releases
Headless Login for WPGraphQL@wpnuxt/auth onlyGitHub releases
Copyright © 2026