Skip to content

Purge cache on post update uses purge cache by Single File option and not purge cache by Prefix #551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks done
SuruRane opened this issue Jan 10, 2025 · 1 comment

Comments

@SuruRane
Copy link

Confirmation

  • My issue isn't already found on the issue tracker.
  • I have replicated my issue using the latest version of the plugin and it is still present.

WordPress version

6.7.1

Cloudflare-WordPress version

4.12.8

PHP version

8.2.26

Expected result

On update of a post, it should purge the post content i.e. using the prefix option and not purge cache by Single File. Purge by Single File purges only the assets and not the entire content.

Actual result

On update of a post, cache is not cleared. The Cloudflare API being used is Purge by Single File which expects files to be assets(i.e. JS/CSS/Images). But instead, the plugin sends all URLs related to the concerned post. i.e current post URL, post taxonomy archive URLs, homepages, feeds, etc.

Steps to reproduce

Analyze the zonePurgeFiles present in Hooks.php. Start debugging from there. Check/echo the API, its headers and data. Compare it with https://developers.cloudflare.com/api/resources/cache/methods/purge/. You would find the data sent to files is incorrect.

Additional factoids

No response

References

No response

@slam-campup
Copy link

We have this issue too.

  • Updating a post does not clear the Cloudflare cache for that post
  • Using the Cloudflare plugin to purge one URL does not clear the Cloudflare cache for that URL
  • Using the Cloudflare plugin to purge all does work as expected

However the solution above to use the prefix option to clear caches would not apply to customers not on the Enterprise Plan, because the prefix options only works on the Enterprise Plan (unless there's an undocumented feature that plugin purges can use prefix option regardless of plan).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants