This plugin enables automatic revalidation of your Next.js site when content is changed in WordPress.
- Upload the
next-revalidate.zipfile through the WordPress admin plugin installer, or - Extract the
next-revalidatefolder to your/wp-content/plugins/directory - Activate the plugin through the WordPress admin interface
- Go to Settings > Next.js Revalidation to configure your settings
After installing and activating the plugin:
- Go to Settings > Next.js Revalidation in your WordPress admin
- Enter your Next.js site URL (without trailing slash)
- Create a secure webhook secret (a random string), you can use
openssl rand -base64 32to generate one - Save your settings
Add the webhook secret to your Next.js environment variables:
# .env.local
WORDPRESS_WEBHOOK_SECRET="your-secret-key-here"- When content in WordPress is created, updated, or deleted, the plugin sends a webhook to your Next.js API route
- The webhook contains information about the content type (post, page, category, etc.) and ID
- The Next.js API validates the request using the secret and revalidates the appropriate cache tags
- Your Next.js site will fetch new content for the affected pages
- Automatic revalidation for posts, pages, categories, tags, and media
- Manual revalidation option through the admin interface
- Secure webhook communication with your Next.js site
- Optional admin notifications for revalidation events
If revalidation isn't working:
- Check that your Next.js URL is correct in the plugin settings
- Verify the webhook secret matches in both WordPress and Next.js
- Check your server logs for any errors in the API route
- Enable notifications in the plugin settings to see revalidation status