WordPress /wp-json/ Returns 404: REST API Diagnosis
A plugin, filter or server rule restricts the WordPress REST API.
Request the WordPress REST index and confirm that the expected namespaces and authentication metadata appear.
Likely causes
- A plugin, filter or server rule restricts the WordPress REST API.
- The requested REST route or tool is not registered in the active WordPress configuration.
- Permalink or rewrite configuration prevents the expected REST base path from resolving.
- The client calls the wrong domain, base path, REST route or MCP endpoint.
- A redirect changes the scheme, host or path and may also discard authentication headers.
Diagnostic sequence
- Request the WordPress REST index and confirm that the expected namespaces and authentication metadata appear.
- Test the REST route fallback used when pretty permalinks are unavailable.
- Confirm the exact scheme, host, base path and endpoint configured in the client.
- Record WordPress, plugin, client, connector and server versions before changing anything.
- Trace every redirect and verify whether scheme, host, path and Authorization are preserved.
- Review the exact WAF or security-plugin event for the route, method and rule identifier.
Apply the smallest correction
- Restore the required REST route or API availability while preserving authentication and permission callbacks.
- Align Home URL, Site URL, public host, HTTPS scheme and REST base address.
- Remove or correct the redirect that changes the authenticated request unexpectedly.
- Adjust only the verified false-positive WAF rule, path or method instead of disabling protection globally.
- Correct the client endpoint, transport, tool name or credential reference without broadening WordPress permissions.
Verify the result
- The REST index responds from the canonical HTTPS URL and exposes the expected namespaces.
- The authenticated request reaches the canonical endpoint without an unexpected redirect.
- The approved narrow read succeeds with a reproducible response.
- The final record contains versions, evidence, change, verification and rollback information without secrets.
What not to do
- Do not disable or reopen the entire REST API when only one route or policy is involved.
- Do not disable the WAF or security plugin globally to bypass one request.
- Do not edit WordPress core or third-party plugin files as the first troubleshooting step.
- Do not grant administrator access merely to make a connection test pass.
- Do not expose debug logs or diagnostic endpoints publicly.
Related guides
- Using the WordPress REST API with an AI Assistant
- A Security Plugin or WAF Is Blocking the WordPress REST API
- WordPress Home URL and Site URL Mismatch Breaks AI Connections
- WordPress AI Connection Redirect Loop: HTTP, HTTPS and Canonical URL Checks
- Troubleshooting Claude Code or Codex Access to WordPress
Sources and verification
This page was checked against the following primary sources. Last source review: .
- REST API Handbook · WordPress Developer Resources
- Routes and Endpoints · WordPress Developer Resources
- REST API Frequently Asked Questions · WordPress Developer Resources
- RFC 9110: HTTP Semantics · RFC Editor