Fetch all Custom Post Types posts from single REST endpoint
-
I am using WordPress as a headless CMS for a blog with the Custom Post Type UI plugin.
I have 3 Custom Post Types: Fashion, Travel, Lifestyle.
Right now I have to make separate fetch requests to each one of these endpoints if I want to get all of the posts.
Current endpoints:
// gets all lifestyle custom posts https://localhost:8888/my-site/wp-json/wp/v2/lifestyle // gets all fashion custom posts https://localhost:8888/my-site/wp-json/wp/v2/fashion // gets all travel custom posts https://localhost:8888/my-site/wp-json/wp/v2/travel
I need to be able to get all the posts from just one endpoint.
Is there a way to set up CPT UI so that custom types share a common endpoint?
Like this:
// gets ALL custom posts https://localhost:8888/my-site/wp-json/wp/v2/all_custom_posts
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Fetch all Custom Post Types posts from single REST endpoint’ is closed to new replies.