#7: post_comments_feed_link

The post_comments_feed_link filter allows you to modify the comments feed URL for the current page or post. Since nothing but the URL is provided to the filter, any conditional work will have to be done by you, such as by accessing the $post global.

It is evaluated in get_post_comments_feed_link() in wp-includes/link-template.php.


Let’s say you (for some reason) will be serving secure content on your comments feed. The following changes the scheme — such as going from http to https — of the post comments feed url.

View the code example on Gist.

Have a suggested improvement? You can fork the Gist and comment back with the link. If all is agreeable, I’ll merge in your changes. Crowd-sourced documentation FTW!

Leave a Reply

Your email address will not be published. Required fields are marked *