• Resolved henmaker

    (@henmaker)


    Hi, this plugin is great, it simply cache all the wp rest api, i know how to exclude some endpoint. But what if the endpoint is:

    /wp-json/wc/v3/products/reviews

    Say i want to exclude “reviews” endpoints, but still want to keep “products”

    What should do from this:

    function wprc_add_wc_endpoints( $allowed_endpoints ) {
        if ( ! isset( $allowed_endpoints[ 'wc/v3' ] ) || ! in_array( 'products', $allowed_endpoints[ 'wc/v3' ] ) ) {
    		$allowed_endpoints[ 'wc/v3' ][] = 'products';
    	}
    
        return $allowed_endpoints;
    }
    add_filter( 'wp_rest_cache/allowed_endpoints', 'wprc_add_wc_endpoints', 10, 1);
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Richard Korthuis

    (@rockfire)

    Hi @henmaker

    Thank you for using our plugin!

    Due to the holidays a bit late answer: At this point it is not possible to exclude a “sub-endpoint”, but we do understand the need. So in our next release we will introduce a new filter wp_rest_cache/disallowed_endpoints which allows you to disable caching for a (sub-)endpoint specifically.

    Plugin Author Richard Korthuis

    (@rockfire)

    Hi @henmaker

    We just released a new version of our plugin, which includes the mentioned filter wp_rest_cache/disallowed_endpoints

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to excluded endpoint of “reviews”?’ is closed to new replies.