Cloudflare-WordPress
Cloudflare-WordPress copied to clipboard
When a post moves from published to draft the page is not cleared
Confirmation
- [X] My issue isn't already found on the issue tracker.
- [X] I have replicated my issue using the latest version of the plugin and it is still present.
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
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.