When I am querying for posts of a CPT, I get a response of 200 but a return of brackets [].
How can I show all of my CPT post data?
My syntax I am using in the url is: http://mydomain/wp-json/wp/v2/myCPT
When I am querying for posts of a CPT, I get a response of 200 but a return of brackets [].
How can I show all of my CPT post data?
My syntax I am using in the url is: http://mydomain/wp-json/wp/v2/myCPT
1 Answer
Reset to default 0So I tried everything and every plugin to fix my issue and expose the list CPT data instead of showing brackets [ ].
And the answer is something that might be a bug in Wordpress Rest API.
The problem was I am using custom statuses and none of my posts were assigned as default Wordpress status. After changing the posts to any of the default built-in statuses, it worked. But doesn't work for custom statuses it seems.... at least not with custom statuses created with a plugin called PublishPress.. Perhaps it just doesn't work with custom statuses at all, all-around
Hope this can help someone else!
'show_in_rest' => true,
when registering the post type? – czerspalace Commented Jun 14, 2019 at 23:57