Production-ready WordPress REST API client for Next.js with advanced caching, retry logic, and multi-locale support
npm install @oxmo88/next-wordpress-apiA powerful tool that connects your Next.js application to WordPress, making it easy to fetch and display your WordPress content with optimal performance.
---
This package helps you build modern, fast websites using WordPress as your content management system and Next.js as your frontend framework. It handles all the complexity of connecting to WordPress, retrieving your content, and making sure everything runs smoothly and quickly.
Think of it as a smart bridge between WordPress (where you create and manage content) and Next.js (where you display that content beautifully).
---
---
✅ Optimized Performance - Automatically reduces data transfer by up to 85%
✅ Smart Caching - Built-in caching keeps your site fast
✅ Automatic Retries - Handles network issues automatically
✅ Multi-Language Ready - Easy support for multilingual sites
✅ Type-Safe - Full TypeScript support prevents errors
✅ Next.js Optimized - Works perfectly with Next.js App Router and Server Components
✅ Production Ready - Built for real-world use with large-scale websites
---
``bash`
npm install @oxmo88/next-wordpress-api
---
`typescript
import { WordPressClient } from '@oxmo88/next-wordpress-api'
// Connect to your WordPress site
const wp = new WordPressClient({
baseUrl: 'https://your-wordpress-site.com'
})
// Get your latest blog posts
const posts = await wp.posts.list({ per_page: 10 })
// Get a specific page
const aboutPage = await wp.pages.getBySlug('about')
// Get categories
const categories = await wp.categories.list()
`
That's it! You're now pulling content from WordPress into your Next.js application.
---
The package gives you easy access to all your WordPress content:
- Posts - Blog articles, news items, or any custom post type
- Pages - Static pages like About, Contact, etc.
- Categories & Tags - Organize and filter your content
- Media - Images, videos, and other media files
- Comments - User comments on posts
- Users - Author information
---
- List View (homepage, archives): Only gets titles, excerpts, and images → 85% less data
- Detail View (full article): Gets complete content with everything you need
- Custom: You choose exactly what fields to fetch
Result: Your pages load 4x faster and use much less bandwidth.
---
If you run a multilingual WordPress site, this package handles language switching seamlessly:
`typescript
// Get posts in English
const englishPosts = await wp.posts.list({ locale: 'en' })
// Get posts in French
const frenchPosts = await wp.posts.list({ locale: 'fr' })
// Get posts in Spanish
const spanishPosts = await wp.posts.list({ locale: 'es' })
`
Works automatically with Polylang and WPML plugins.
---
This package is specifically designed to work perfectly with Next.js features:
- Server Components - Fetch content directly in your components
- Static Site Generation (SSG) - Pre-build pages at build time
- Incremental Static Regeneration (ISR) - Update static pages without rebuilding
- API Routes - Create custom API endpoints
---
- Developers building modern websites with WordPress and Next.js
- Agencies creating client websites that need performance and reliability
- Content Creators who want to use WordPress for content but need a faster frontend
- Businesses running multilingual websites
- Anyone wanting to combine WordPress's excellent content management with Next.js's speed and modern features
---
- Next.js 13 or higher
- WordPress 6.0 or higher with REST API enabled (enabled by default)
- Node.js 18 or higher
---
Install the package and start building:
`bash``
npm install @oxmo88/next-wordpress-api
For detailed documentation and advanced features, visit the full documentation.
---
MIT
---
Built for developers who want the content power of WordPress with the performance of Next.js.