wp-json Returns 404 Upon Plugin Activation


I’m creating a custom plugin. Recently, it’s created errors and I don’t know the cause.

When the plugin is activated I receive this error in the Site Health Screen:

The REST API call gave the following unexpected result: (404)
{"code":"rest_no_route","message":"No route was found matching the URL
and request method","data":{"status":404}}.

if I navigate to /wp-json I get:

{"code":"rest_no_route","message":"No route was found matching the URL
and request method","data":{"status":404}}

When I deactivate the plugin the error is gone from Site Health and I can see content at /wp-json.

I’ve tried to figure it out and research for hours to no avail. I read about .htaccess problems so I deleted mine and regenerated it. But I know it’s related to the plugin somehow.

Any ideas?

Amy 3 months 0 Answers 6 views 0

Leave an answer