I work on a site that is entirely cached by a CDN. We are about to roll out comments and will be moderating every comment before it goes live. When someone posts a comment and the page is rendered with a message indicating their comment is being held in moderation. What I don’t want is for the CDN to cache this page with the moderation message. What can I do to prevent this?
Ideally I would be able to hook in somewhere and return the URL with a query string in it which aren’t cached by our CDN.
Figured it out. Looking at wp-comments-post.php there is a filter called
comment_post_redirect
which I used to check if the comment was approved and then added a query string to the URL. So easy.