Fetch all posts (including those using a custom post type) with WordPress API

With the WordPress API, we can use the following request to get all posts of the default ‘post’ type:

http://example.com/wp-json/wp/v2/posts

Supposing the ‘books’ and ‘movies’ custom post types have been created, we can get all posts in each custom post type with the following requests:

http://example.com/wp-json/custom/v1/books
http://example.com/wp-json/custom/v1/movies

Is there a similar request that can be made to obtain all the above posts, meaning those that use the default ‘post’ post type as well as those that use the ‘books’ and ‘movies’ custom post types?

Read more here:: Fetch all posts (including those using a custom post type) with WordPress API

Leave a Reply

Your email address will not be published. Required fields are marked *