Getting Started
Prerequisites
- Node.js version 18 or higher.
- An accessible Wordpress instance, with API enabled.
- Optional Wordpress Application credentials to use advanced features :
- Menus
- Contact form
Installation
Setup
sh
$ npm add -D nuxt-wp
sh
$ pnpm add -D nuxt-wp
sh
$ yarn add -D nuxt-wp
sh
$ bun add -D nuxt-wp
ts
export default defineNuxtConfig({
modules: ['nuxt-wp'],
})
Config
In order to work, you need to provide the API endpoint :
sh
WP_API_ENDPOINT=https://your-wordpress-site.com/wp-json
ts
export default defineNuxtConfig({
wordpress:{
apiEndpoint: 'https://your-wordpress-site.com/wp-json',
},
})
If you want to use advances features, you need to provide Application Credentials too :
sh
WP_API_ENDPOINT=https://your-wordpress-site.com/wp-json
WP_APPLICATION_USER=your-username
WP_APPLICATION_PASSWORD=your-password
ts
export default defineNuxtConfig({
wordpress:{
apiEndpoint: 'https://your-wordpress-site.com/wp-json',
applicationUser: 'your-username',
applicationPassword: 'your-password'
},
})