Skip to content

Latest commit

 

History

History

docs

README.md

@axistaylor/nextpress

@axistaylor/nextpress

A comprehensive toolkit for rendering WordPress Gutenberg content 1:1 in Next.js applications.

Table of Contents

Guides

API Reference

  • API Overview — Complete API reference
  • WPHead — Render all head assets (global styles, stylesheets, import map, scripts)
  • WPFooter — Render footer scripts
  • Content — Render WordPress HTML content with custom parsers
  • Parsers — Built-in parsers (nextImageParser, createUrlRewritingParser) and custom parser guide
  • Page Events — WordPress script lifecycle events in headless environments
  • WPScripts — Core script renderer (classic, deferred, async, module)
  • ImportMap — Script module import map for the Interactivity API
  • AssetUpdater — Client-side asset refresh on navigation
  • withWCR — Next.js configuration wrapper
  • proxyByWCR — Middleware proxy for WordPress APIs

Quick Links

Introduction

NextPress bridges the gap between WordPress and Next.js, enabling you to render Gutenberg content with pixel-perfect accuracy in your React applications. It handles the complexities of WordPress scripts, styles, block markup, and the Interactivity API so you can focus on building your application.

Key Features

  • 1:1 Content Rendering — Render WordPress Gutenberg blocks exactly as they appear on your WordPress site
  • Script Modules & Interactivity API — Full support for viewScriptModule blocks, ES module import maps, and @wordpress/interactivity
  • Script Management — Load WordPress scripts with proper dependency resolution, deferred/async strategies, and synthetic page events for DOMContentLoaded compatibility
  • Style Handling — Global styles, scoped block stylesheets, and core-block-supports layout CSS
  • Image Optimization — Optional nextImageParser converts WordPress images to next/image for WebP/AVIF
  • Multi-site Support — Connect to multiple WordPress backends with automatic cross-origin proxy routing
  • WordPress Plugin — Companion plugin for GraphQL asset queries, script module registry, and URL transforms

How It Works

NextPress provides a set of React components and Next.js utilities that work together to fetch and render WordPress content:

  1. WPHead — Renders all <head> assets in one component: global styles, stylesheets, import map, and header scripts
  2. WPFooter — Renders footer scripts with proper load strategies
  3. Content — Parses and renders WordPress HTML content with customizable parsers (URL rewriting, image optimization, custom element handling)
  4. AssetUpdater — Keeps assets in sync on client-side navigation and fires synthetic page events
  5. withWCR / proxyByWCR — Next.js configuration and middleware for secure WordPress API communication

Get started by following the Getting Started guide.