Migration

From v1 to v2

Migrate from WPNuxt 1.x to 2.x

WPNuxt 2.x is a rewrite for Nuxt 4 with a simplified API.

AI-Assisted Migration: If you're using an AI assistant with the WPNuxt MCP server, the wpnuxt_migrate tool can automatically scan your v1 project, identify breaking changes, detect usage anti-patterns (like composables called inside onMounted that break SSR), and generate compatibility helpers. Simply ask your AI assistant to "help me migrate to WPNuxt v2" with your project files.

Migration Difficulty

ScenarioEffort
Basic queries (Posts, Pages, Menu)30 min
Custom queries + blocks1-2 hours
Using removed features2-4 hours

Breaking Changes

Nuxt 4 Required

WPNuxt 2.x requires Nuxt 4. Upgrade Nuxt first.

Package Installation

- pnpm add @wpnuxt/core@^1.0.0
+ pnpm add @wpnuxt/core@^2.0.0

Composable Names

The configurable prefix is removed. Composables now use fixed use prefix:

- const { data } = await useWPPosts()
+ const { data } = await usePosts()

- const { data } = await useAsyncWPPosts()
+ const { data } = usePosts({}, { lazy: true })

Configuration

wpNuxt: {
  wordpressUrl: 'https://example.com',
- frontendUrl: 'https://frontend.com',
- defaultMenuName: 'main',
- enableCache: true,
- cacheMaxAge: 300,
- staging: false,
- logLevel: 3,
- composablesPrefix: 'useWP',
+ debug: false,
+ graphqlEndpoint: '/graphql',
+ cache: {
+   enabled: true,
+   maxAge: 300,
+   swr: true
+ },
  queries: {
-   extendDir: 'extend/queries',
-   outputDir: '.queries'
+   extendFolder: 'extend/queries/',
+   mergedOutputFolder: '.queries/'
  }
}

Directive

- <div v-sanitize-html="content" />
+ <div v-sanitize-html="content" />

Removed Features

These features are not in v2:

RemovedAlternative
useFeaturedImage()Access post.featuredImage.node directly
isStaging()Use process.env.NODE_ENV
useWPUri()Use useRoute().params
<WPContent>Use v-sanitize-html or @wpnuxt/blocks
<ContentRenderer>Use v-sanitize-html
<StagingBanner>Implement yourself if needed
frontendUrl configAdd to runtimeConfig if needed
staging configUse environment variables
usePrevNextPost() has been re-added in v2 and works out of the box.

Migration Checklist

  • Upgrade to Nuxt 4
  • Update @wpnuxt/core to ^2.0.0
  • Update @wpnuxt/blocks to ^2.0.0 (if used)
  • Update nuxt.config.ts options
  • Rename composables (useWPPostsusePosts)
  • Convert async variants to lazy option (useAsync*use*({}, { lazy: true }))
  • Change v-sanitize to v-sanitize-html
  • Replace removed composables
  • Test all pages
  • Test production build

Common Issues

"Cannot find module '#wpnuxt'"

pnpm dev:prepare

Composable not found

Check that query name matches (case-sensitive). Run pnpm dev:prepare after adding queries.

Types not working

  1. Run pnpm dev:prepare
  2. Restart your IDE's TypeScript server

Need Help?

Copyright © 2026