Friday, June 3, 2022
HomeWordPress Developmentblock editor - 404 in gutenberg autosave of a Customized Publish Sort...

block editor – 404 in gutenberg autosave of a Customized Publish Sort with customized rest_namespace


I am having some troubles with CPTs outlined with customized rest_namespace at register_post_type. I maintain getting an 404 error on the console. The error reveals that the namespace isn’t being modified in autosave route.

WP default namespace: wp/v2

Customized namespace outlined: ek/v1

I dug into the core lessons to seek out how WordPress deal with customized namespace.

The WP_REST_Autosaves_Controler outline the namespace utilizing get_post_type_object on the __construct methodology:

...
$post_type_object = get_post_type_object( $parent_post_type );
....
$this->namespace = ! empty( $post_type_object->rest_namespace ) ? $post_type_object->rest_namespace : 'wp/v2';
...

If I do a discovery request on the ek/v1 I can see the endpoints registered appropriately:

"/ek/v1/releases/(?P<dad or mum>[d]+)/autosaves/(?P<id>[d]+)"

However within the console this error pops up:

GET http://localhost:8888/wp-json/wp/v2/releases/70/autosaves?context=edit&_locale=consumer 404 (Not Discovered)

So, why the default namespace persist if I did all proper?
Would it not be some javascript perform of wordpress that might be doing the request on the inaccurate route? What perform? Tips on how to repair it?

enter image description here

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments