cloudflare / Cloudflare-WordPress

A Cloudflare plugin for WordPress
https://www.cloudflare.com/wordpress/
BSD 3-Clause "New" or "Revised" License
215 stars 84 forks source link

How to purgeCacheEverything correctly? #510

Closed peixotorms closed 9 months ago

peixotorms commented 1 year ago

Confirmation

WordPress version

6.2.1

Cloudflare-WordPress version

4.1.1.0

PHP version

8.1

Expected result

Hi,

I am trying to programmatically purge Cloudflare APO from my plugin, but it's not working. I have separation for mobile and desktop users enabled on APO.

Is this the correct method to purge everything?

# purge cloudflare APO (requires cloudflare plugin)
    if (class_exists('\CF\WordPress\Hooks') && method_exists('\CF\WordPress\Hooks', 'purgeCacheEverything')) {
        global $cloudflareHooks;
        if ( $cloudflareHooks instanceof \CF\WordPress\Hooks ) {
            $cloudflareHooks->purgeCacheEverything();
            $ret[] = __( 'Cloudflare Purge Request Sent!' );
        }
    }

I can see that "Cloudflare Purge Request Sent!" is returned correctly, but the actual page doesn't seem to update, unless I go to the cloudflare plugin and hit purge cache.

Also, how can I purge an array of urls specifically?

Thanks

Actual result

it's not purging

Steps to reproduce

just check my code

Additional factoids

N/A

References

N/A

github-actions[bot] commented 10 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.