Custom endpoint
-
Hi
Our Endpoint: /wp-json/example1/v2/PostID/(page)/
function wprc_add_acf_posts_endpoint( $allowed_endpoints ) { if ( ! isset( $allowed_endpoints[ 'example1' ] ) || ! in_array( 'v2', $allowed_endpoints[ 'example1' ] ) ) { $allowed_endpoints[ 'example1' ][] = 'v2'; } return $allowed_endpoints; } add_filter( 'wp_rest_cache/allowed_endpoints', 'wprc_add_acf_posts_endpoint', 10, 1);
I want to know if I’m doing it right.
In the admin page appears the list as follows.Endpoint API Caches
Cache Key Request URI Request Headers Request Method Object Type Expiration # Cache Hits Active 87a4f82e53a5af1b6010d39dbee6fa3b /wp-json/example1/v2/9 [] GET unknown 2023-11-01 21:08:13 13 Cache is ready to be served. 210e9e3a3b9a798c9b55fdea65278f7d /wp-json/example1/v2/3 [] GET unknown 2023-11-01 21:07:18 4 Cache is ready to be served. deccffd614cbb39559f9863cd84ca790 /wp-json/example1/v2/4 [] GET unknown 2023-11-01 21:07:19 5 Cache is ready to be served.
Thanks
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Custom endpoint’ is closed to new replies.