Make authorization mandatory on custom routes
Late, but maybe helpful for other readers as I added solution specifically to above code of this question. Solution: Permission Callback function WordPress: version 5.7.2 PHP: version 7.4 host: hostmonster.com client: Windows 10 browsers: tested on Chrome, Firefox, even Edge š worked Code (PHP code in function.php of your installed theme): add_action(‘rest_api_init’, function() { /** … Read more