wp-api-fetch-client
Installation
SKILL.md
WordPress API Fetch Client
Use this skill for JavaScript that calls inbound WordPress REST routes. Use
wp-rest-api for server route registration and authorization. Keep outbound
PHP integrations in wp-http-api-client.
Read reference.md for standalone npm bootstrapping, the full option/return contract, middleware behavior, media uploads, and test patterns.
Choose the actual runtime
Determine what reaches the browser; do not infer it from an import alone.
| Runtime | How to recognize it | Required setup |
|---|---|---|
| WordPress global | PHP depends on wp-api-fetch; code calls wp.apiFetch |
Core supplies REST root, nonce, nonce-refresh endpoint, and media middleware |
| Externalized npm import | Source imports @wordpress/api-fetch; generated .asset.php includes wp-api-fetch |
Enqueue the asset dependencies; the import resolves to the configured WordPress global |
| Privately bundled npm copy | Bundle contains its own @wordpress/api-fetch; no wp-api-fetch dependency |
Configure root and authentication middleware for that instance |