Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Cache doesn’t work

$
0
0

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?

  • This topic was modified 20 minutes ago by m777.
  • This topic was modified 19 minutes ago by m777.

Viewing all articles
Browse latest Browse all 59525

Trending Articles