First install this plugin: WP REST Cache then add this code in functions.php to enable form schema cache for contact form 7. You should use a child theme unless you’re using a custom build theme.
Here’s the snippet:
function tgg_add_cf7_endpoint( $allowed_endpoints ) {
if ( ! isset( $allowed_endpoints[ 'contact-form-7/v1' ] ) || ! in_array( 'contact-forms', $allowed_endpoints[ 'contact-form-7/v1' ] ) ) {
$allowed_endpoints[ 'contact-form-7/v1' ][] = 'contact-forms';
}
return $allowed_endpoints;
}
add_filter( 'wp_rest_cache/allowed_endpoints', 'tgg_add_cf7_endpoint', 10, 1);
This will improve the GTmetrix speed score of the website.
You should see this kind of entries, if rest cache is working:
Cache endpoint example:
Request URI : /wp-json/contact-form-7/v1/contact-forms/91/feedback/schema