add_action('rest_api_init', function() {
    remove_filter('rest_pre_serve_request', 'rest_send_cors_headers');

    add_filter('rest_pre_serve_request', function($value) {
        $origin = isset($_SERVER['HTTP_ORIGIN'])
            ? $_SERVER['HTTP_ORIGIN']
            : '';

        if ($origin === 'https://radical-press-flow-go.base44.app') {
            header('Access-Control-Allow-Origin: ' . $origin);
            header('Access-Control-Allow-Credentials: true');
            header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
            header('Access-Control-Allow-Headers: Authorization, Content-Type, Accept');
        }

        if (
            isset($_SERVER['REQUEST_METHOD']) &&
            $_SERVER['REQUEST_METHOD'] === 'OPTIONS'
        ) {
            status_header(200);
            exit;
        }

        return $value;
    });
}, 15);{"id":257,"date":"2021-01-12T19:54:17","date_gmt":"2021-01-12T19:54:17","guid":{"rendered":"https:\/\/gardenadvice.co.uk\/my-garden-team\/katherineandgavin\/your-garden-pictures\/your-garden-pictures\/"},"modified":"2021-01-12T19:54:17","modified_gmt":"2021-01-12T19:54:17","slug":"your-garden-pictures","status":"publish","type":"page","link":"https:\/\/gardenadvice.co.uk\/harry\/your-garden-pictures\/","title":{"rendered":"Your Garden Pictures"},"content":{"rendered":"ngg_shortcode_0_placeholder\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":4,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"ngg_post_thumbnail":0,"footnotes":""},"class_list":["post-257","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/gardenadvice.co.uk\/harry\/wp-json\/wp\/v2\/pages\/257","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gardenadvice.co.uk\/harry\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/gardenadvice.co.uk\/harry\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/gardenadvice.co.uk\/harry\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/gardenadvice.co.uk\/harry\/wp-json\/wp\/v2\/comments?post=257"}],"version-history":[{"count":0,"href":"https:\/\/gardenadvice.co.uk\/harry\/wp-json\/wp\/v2\/pages\/257\/revisions"}],"wp:attachment":[{"href":"https:\/\/gardenadvice.co.uk\/harry\/wp-json\/wp\/v2\/media?parent=257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}