I have a custom post type (article) and have implemented a custom REST API endpoint for that post type. I can retrieve single and multiple articles via the custom endpoint without any issues.
However, when I try to add a new or edit an existing article post within WP Admin, I just get a white screen. The web console shows an error that the rest route does not exist but it is using the standard WP REST Route "No route was found matching the URL and request method." The GET call is to /wp-json/wp/v2/article. The route should be /wp-json/kbs/v1/articles – and that route works. When registering the post type I have the following args…
'show_in_rest' => true, 'rest_base' => 'articles', 'rest_controller_class' => 'KBS_Articles_API'
How can I ensure that WP uses the correct route when loading the block editor? Editing with the classic editor works fine.