REST API not working on custom posts

I created a custom post in my functions.php file, it works great for me. When I call custom post data through the WordPress REST API, it shows me an error in the browser.

Below is the error that 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 the rest API works for the default post that is present in WordPress.

+3


source to share


1 answer


For a personalized message, we need to enable the Rest API below:



'show_in_rest' => true,

      

+3


source







All Articles