Extending the WordPress REST API

Your video will begin in 10
60 Views
Published
The WordPress REST API provides an interface for fetching, adding, updating, and deleting data from a WordPress site in a uniform way.

While the schema for the data types that are available in the REST API is quite extensive, there may be times when you need to store additional data that is not part of the core schema.

In this lesson, you will learn about two methods of adding fields to your REST API requests, either by enabling custom fields in the REST API route, or by making custom fields available as top-level fields.
---
View this lesson and others in this course on Learn WordPress:
https://learn.wordpress.org/course/beginner-wordpress-developer/

0:00 Introduction
0:55 Important note about modifying responses
1:40 Working with custom fields
2:34 Registering a custom field
4:36 Enabling Custom Fields for the specific WP REST API routes
7:41 Adding Custom Fields as top level fields to API Responses
8:09 Adding a custom field as a top level field
12:21 Including Schema
12:55 To register_rest_field or not
14:07 Further reading
Category
WordPress
Tags
2024, Learn WordPress, WordPress.tv
Be the first to comment