2

I would like to know if there is a way to prevent cache in wordpress inside the REST API.I have this minimal example:

add_action('rest_api_init', 'get_wp_page_fn2' );

function get_wp_page_fn2(){
    register_rest_route( '/wp/v2/tf_api/' ,'get_wp_page2', 
        array(
            'methods'  =>'GET',
            'callback' => 'get_wp_page_callback2',
        ) 
    );
}

function get_wp_page_callback2( $request) {
    $response = [
        "response" => 1,
        "url" => 33,
    ];
    echo json_encode($response);
    die(); 
}

If I change "response" => test, it takes about 5/10 minutes to update it. It's kind of a nightmare to do dev like that.

I try a lot of stuff but nothing seems to be working

0

1 Answer 1

1

Took me like a day. Since I'm using Mamp pro, I have to deal with this https://documentation-4.mamp.info/en/MAMP-PRO-Mac/Languages/PHP/index.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.