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.