Replies: 0
Hello
I’ve tried a lot of times this plugin with custom methods and added function below but cache doesn’t works anyway.(
add_action( 'rest_api_init', function () {
register_rest_route( 'places', 'all', array(
'methods' => 'GET',
'callback' => 'api_get_places_all',
) );
} );
and tried with version define like this:
add_action( 'rest_api_init', function () {
register_rest_route( 'v1/places', 'all', array(
'methods' => 'GET',
'callback' => 'api_get_places_all',
) );
} );
——
function wprc_add_places_list_endpoint( $allowed_endpoints ) {
if ( ! isset( $allowed_endpoints[ 'places' ] ) || ! in_array( 'all', $allowed_endpoints[ 'places' ] ) ) {
$allowed_endpoints[ 'places' ][] = 'all';
}
return $allowed_endpoints;
}
add_action( 'wp_rest_cache/allowed_endpoints', 'wprc_add_places_list_endpoint', 10, 1);
Maybe plugin require any server settings for normal functionality?