wp-api-client

Fetch WordPress REST API content in TypeScript with query-driven response types.

Updated Jun 9, 2026
One-click install
npx skills add https://github.com/hideokamoto/node-wp-api-client --skill wp-api-client-hideokamoto
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: wp-api-client
Source: https://github.com/hideokamoto/node-wp-api-client/tree/main/skills/wp-api-client
Command: npx skills add https://github.com/hideokamoto/node-wp-api-client --skill wp-api-client-hideokamoto

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires node-wp-api-client, and includes references (resource) components.

What problem does it solve? The WordPress REST API changes its response shape depending on query parameters like _fields, _embed, and context, forcing developers to write manual type casts or guess at return types. This Skill guides you in using node-wp-api-client, a type-safe GET-only client where TypeScript types automatically follow the query you write. ## Core Features & Use Cases - Query-driven typing: Response types automatically reflect _fields picks, _embed intersections, and context (view/embed/edit) transformations, with compile-time validation of field names. - Full collection coverage: Built-in collections for posts, pages, categories, tags, media, and users, plus custom post types, taxonomies, search, and HATEOAS link traversal via discover() and fetchLink(). - Use Case: Building a Next.js blog that lists posts with embedded featured images — write wp.posts.list({ _embed: true, _fields: ['id', 'title', '_embedded'] }, { next: { revalidate: 1800 } }) and get fully typed results with framework caching and automatic retries. ## Quick Start Ask the AI to write TypeScript code that fetches the ten most recent posts from your WordPress site using node-wp-api-client with embedded author and term data.

Frequently Asked Questions about wp-api-client

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fetch WordPress posts in TypeScript with typed responses?▼

Use createWPClient from node-wp-api-client and call wp.posts.list() with your query. The return type automatically follows your _fields, _embed, and context parameters, so no manual casts or as const annotations are needed.

How to get custom post types from the WordPress REST API?▼

Call wp.postType('your-rest-base') to create a collection for any custom post type, optionally passing a custom entity type for ACF fields. It exposes the same list, listAll, get, and getBySlug methods as built-in collections.

Does node-wp-api-client work on Cloudflare Workers or edge runtimes?▼

Yes, node-wp-api-client works on Cloudflare Workers and other edge runtimes with a native fetch. It requires Node.js 20.19+ or 22.12+ for server environments and accepts a custom fetch implementation via config.

Can node-wp-api-client create or update WordPress content?▼

No, node-wp-api-client is GET-only and cannot create or update content. For write operations, use authenticated fetch calls or another tool that supports the WordPress REST API mutation endpoints.

Why is _embedded missing when combining _embed with _fields?▼

The WordPress server strips _embedded unless it is explicitly listed in _fields, and the library's types reflect that behavior. Include '_embedded' in your _fields array alongside _embed: true to receive the embedded payload.