Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 524
Vishal Gupta Avatar asked Jun 27 '17 11:06

Vishal Gupta


1 Answers

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

'show_in_rest' => true,
like image 198
Amit Dinda Avatar answered Oct 24 '22 04:10

Amit Dinda