From the course: WordPress: REST API
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Notes on modifying a REST API response - WordPress Tutorial
From the course: WordPress: REST API
Notes on modifying a REST API response
- [Instructor] The default response from the WordPress rest API is pretty comprehensive and with the long list of links at the bottom of each post object and the embedding feature, you're able to get most content with ease. Even so there will be times when you need some additional content added to the response to add a new content type or feature to the site or app your building. In this chapter we'll explore how to extend the API response by adding new custom post types, new taxonomies, and new fields in the response itself. What you learn here will enable you to extend the API to work with pretty much any custom setup you choose to create for your WordPress installation. Now, before we start let me briefly address an important principle when we're working with APIs. Existing APIs should be extended, not modified. Anytime you want to change the API output to fit your needs, add new fields or features, rather than…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.