Vishal Gupta
Vishal Gupta

Reputation: 903

REST API not working in custom post

I have created the custom post in function.php file, it is working fine for me. When I call custom post data via WordPress REST API, It is showing me the error on browser.

Below is the error which was showing me in the browser.

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

But rest API is working for default post which is present in WordPress.

Upvotes: 5

Views: 1251

Answers (1)

Amit Dinda
Amit Dinda

Reputation: 66

For custom post we need to allow the Rest API below is the code

'show_in_rest' => true,

Upvotes: 4

Related Questions