I would like to know if it is possible to set rest API endpoints from within a theme?
I created a class to do this and made an instance of the class in the theme's functions.php
file. This triggers the constructor which calls the add_action()
function. When I check the path, I get a 404 message saying this endpoint is not there.
Is there a way to make sure the endpoint created as part of my theme works? I assume that the theme is not normally loaded when the REST API is called.