cloudflare / Cloudflare-WordPress

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

When a post moves from published to draft the page is not cleared #527

Closed richbscott closed 1 month ago

richbscott commented 8 months ago

Confirmation

WordPress version

6.3.2

Cloudflare-WordPress version

4.12.2

PHP version

8.1

Expected result

When saving a published post to a draft I expected the frontend website page URL to be cleared from Cloudflare.

Actual result

The page was not cleared from cloudflare.

Steps to reproduce

Create a new post. Save as published. Unpublish the post to save back as draft. The page is still accessible and not cleared in Cloudflare.

Additional factoids

This appears to be down to the fact that when it generates the URL's to clear it uses get_permalink on the post. As the post has been moved to a draft state this returns the URL to clear in the format: /?post_type=my_post_type&p=13977

rather than the published clean URL and the publised URL is therefore never added to the list of URL's to be cleared thus leaving the published URL in cloudflare. e.g. /my-test-post

References

No response

github-actions[bot] commented 2 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.