From the course: WordPress: REST API

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Add custom fields to the response

Add custom fields to the response - WordPress Tutorial

From the course: WordPress: REST API

Start my 1-month free trial

Add custom fields to the response

- Once you start using the REST API, there's a good chance you'll find yourself needing to add custom content to the REST API response either because you need to modify what's already there, or because you need to add new data. This is done using standard PHP and WordPress functions and a plugin or child theme or full theme. Where exactly that code resides depends on how and where that new content will be used. If it's going to be used only by a specific theme or child theme, it should probably live within that theme. If on the other hand, it will be used by different plugins and themes and maybe moved to different sites, it should probably live in its own plugin. In the exercise files for this movie, 02 03, you'll find an example plugin I've created that as a field to the REST API. So if you go to the exercise files, you can install it into your local sites by placing it under WP content and plugins. You'll find it…

Contents