The REST API encountered an unexpected result
-
swg proxy + docker + wordpress image latest == php 8.2.25
Hi, I get this message with the normal test: The REST API encountered an unexpected result
The REST API is one way that WordPress and other applications communicate with the server. For example, the block editor screen relies on the REST API to display and save your posts and pages.
When testing the REST API, an unexpected result was returned:
REST API Endpoint: https://yourdomain.com/wp-json/wp/v2/types/post?context=edit
REST API Response: (403) ForbiddenOn pasting this URL (https://example.com.test/wp-json/wp/v2/types/post?context=edit) in the browser, I get {“code”:”rest_forbidden_context”,”message”:”Sorry, you are not allowed to edit posts in this post type.”,”data”:{“status”:401}}
If I change this URL to context=view (https://example.com.test/wp-json/wp/v2/types/post?context=view) in the browser, I get
{“description”:””,”hierarchical”:false,”has_archive”:false,”name”:”Posts”,”slug”:”post”,”icon”:”dashicons-admin-post”,”taxonomies”:[“category”,”post_tag”],”rest_base”:”posts”,”rest_namespace”:”wp\/v2″,”_links”:{“collection”:[{“href”:”https:\/\/example.com.test\/wp-json\/wp\/v2\/types”}],”wp:items”:[{“href”:”https:\/\/example.com.test\/wp-json\/wp\/v2\/posts”}],”curies”:[{“name”:”wp”,”href”:”https:\/\/api.w.org\/{rel}”,”templated”:true}]}}
Both seem to indicate that REST API is working, so what’s wrong and why is the test failing? I suspect your plugin was not vetted against PHP 8. The details indicate you tested it up to PHP 7.3.
The wordpress image provided by WordPress is using PHP 8. Were you aware?
- You must be logged in to reply to this topic.