This class is used to create a new REST API route.
To create a new class for the REST API route, run this command:
wp boilerplate create rest-route
The output will ask you to input the correct endpoint slug and method (
GET, etc.). Everything else will be done for you, setting the namespace, package, vendor prefixes, class, and folder name, and you will be set to write your field implementation in the
Test it in action
To test it in action, you should check the
wp-json path in your browser. You can do that with something like this:
This link will be different based on your project implementation.