wp_rest_cache/allowed_endpoints does not work for me
-
On almost pure wordpress 5.8.2, simple code to test, but doesn’t activate the plugin = (
add_filter('wp_rest_cache/allowed_endpoints', function ($endpoints) { $endpoints['ahsle/v1'] = ['page']; return $endpoints; }, 10, 1); add_action('rest_api_init', function () { register_rest_route('ahsle/v1', '/page', [ 'methods' => 'POST', 'callback' => function () { $posts = get_posts([ 'post_type' => 'page' ]); return $posts; } ]); });The standard wp rest api endpoints work as expected.
Why it happens?Thanks for the plugin!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘wp_rest_cache/allowed_endpoints does not work for me’ is closed to new replies.