Custom Endpoint
-
Hello,
I have this url – https://www.bentahero.com/wp-json/adforest/v1/home
I wanted to cache the home page of the app.
I added the code below to functions.php but its not working…
function wprc_add_home_endpoint( $allowed_endpoints ) { if ( ! isset( $allowed_endpoints[ 'adforest/v1/home' ] ) || ! in_array( 'home', $allowed_endpoints[ 'adforest/v1/home' ] ) ) { $allowed_endpoints[ 'adforest/v1/home' ][] = 'home'; } return $allowed_endpoints; } add_filter('wp_rest_cache/allowed_endpoints', 'wprc_add_home_endpoint', 10, 1);
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Custom Endpoint’ is closed to new replies.