Skip to content

Instantly share code, notes, and snippets.

View jarridlima's full-sized avatar
🎯
Focusing

Jarrid Lima jarridlima

🎯
Focusing
View GitHub Profile
<?php
// Add this code in your 'theme folder' > functions.php
function my_customize_rest_cors() {
remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' );
add_filter( 'rest_pre_serve_request', function( $value ) {
header( 'Access-Control-Allow-Origin: *' );
header( 'Access-Control-Allow-Methods: GET' );
header( 'Access-Control-Allow-Credentials: true' );