npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@oxmo88/next-wordpress-api

v1.1.0

Published

Production-ready WordPress REST API client for Next.js with advanced caching, retry logic, and multi-locale support

Readme

WordPress API Client for Next.js

A powerful tool that connects your Next.js application to WordPress, making it easy to fetch and display your WordPress content with optimal performance.


What Does This Package Do?

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).


Why Use This Package?

Faster Loading Times

WordPress normally sends way more data than you need. This package automatically optimizes what gets sent, making your pages load up to 4 times faster and using 85% less bandwidth.

Works Reliably

Internet connections aren't perfect. This package automatically retries failed requests and handles errors gracefully, so your website stays reliable even when things go wrong.

Built-in Caching

Content is automatically cached (stored temporarily) so repeat visits are lightning fast. The package is smart about when to refresh content and when to use the cached version.

Multi-Language Support

If your WordPress site supports multiple languages (using Polylang or WPML), this package makes it seamless to fetch content in any language.

Simple to Use

You don't need to be an expert in APIs or WordPress. The package provides simple, straightforward methods to get posts, pages, categories, media, and more.


Key Features at a Glance

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


Quick Installation

npm install @oxmo88/next-wordpress-api

Simple Example

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.


What Can You Fetch?

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

How It Improves Performance

The Problem

By default, WordPress sends huge amounts of data - about 50KB per blog post, even when you only need the title and excerpt for a list. For a homepage showing 20 posts, that's over 1MB of unnecessary data!

The Solution

This package has smart "modes" that automatically fetch only what you need:

  • 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.


Multilingual Support Made Easy

If you run a multilingual WordPress site, this package handles language switching seamlessly:

// 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.


Built for Next.js

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

Who Should Use This?

  • 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

System Requirements

  • Next.js 13 or higher
  • WordPress 6.0 or higher with REST API enabled (enabled by default)
  • Node.js 18 or higher

Get Started

Install the package and start building:

npm install @oxmo88/next-wordpress-api

For detailed documentation and advanced features, visit the full documentation.


License

MIT


Built for developers who want the content power of WordPress with the performance of Next.js.