Skip to content

Instantly share code, notes, and snippets.

@robwent
Last active April 24, 2025 20:00
Show Gist options
  • Save robwent/fa8df36eb81f0ecaac37b86e8210a4ab to your computer and use it in GitHub Desktop.
Save robwent/fa8df36eb81f0ecaac37b86e8210a4ab to your computer and use it in GitHub Desktop.
Caching Contact Form 7 Schema Requests
<?php
add_filter( 'wp_rest_cache/allowed_endpoints', function ( $allowed_endpoints ) {
if ( ! isset( $allowed_endpoints['contact-form-7/v1'] ) ) {
$allowed_endpoints['contact-form-7/v1'] = [];
}
if ( ! in_array( 'contact-forms', $allowed_endpoints['contact-form-7/v1'], true ) ) {
$allowed_endpoints['contact-form-7/v1'][] = 'contact-forms';
}
return $allowed_endpoints;
}, 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment