Closed tangrufus closed 7 years ago
All set! https://github.com/dmchale/disable-json-api/commit/f907172e83021f622b3007ef363bc5fa6c610cdc
This does open my eyes to the fact that I have additional testing to do for multisite, too. These functions won't work properly on multisite installs but I thought I'd patch this for now and circle back to those.
Try:
var restPath = '<?php echo rest_url(); ?>';
See:
Going further:
routes
by PHP:
$wp_rest_server = rest_get_server();
$routes = $wp_rest_server->get_routes();
routes
to JS via wp_localize_script
This can save some jQuery ajax code.
Or, we don't need the JS part at all
Converted admin page to php-based rather than JS-based: https://github.com/dmchale/disable-json-api/commit/6af19e4377efdc639ad53ee08dbdc3df15753f95
Example:
When pretty permalinks is disabled, it works.