How to excluded endpoint of “reviews”?
-
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)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to excluded endpoint of “reviews”?’ is closed to new replies.