Disable comments feed(s) to protect a secret category
I’m trying to create a ‘members only’ category for a WP site. I’ve found various ways to hide this category from most of the common WP functions; and some (eg monthly archives) I’ve just decided not to use at all.
But members will be able to comment on those private posts; and those comments will appear in the site-wide comments feed: revealing the existence of the private area, the title of posts within it, and the actual comments.
There’s also a risk of people guessing the post IDs for ‘hidden’ posts, and using query string-based URLs. Whilst I can stop them seeing the content by putting if(is_user_logged_in) at the top of single.php, I can’t stop them seeing the comments on those hidden posts by using a query string like /?p=1&feed=rss2
Some ideas I’ve tried:
- Advanced Category Excluder would let me disable the comments feeds for individual posts in the secret category, but it doesn’t stop those comments appearing in /comments/feed (as far as I can tell)
- I can use htaccess to do a RewriteMatch on /comments/feed or/wp-commentsrss2.php, and send people somewhere else, but I haven’t been able to do the same for query string based URLs (whatever they are?).
On balance, I’m guessing the easiest thing is simply to disable comment feeds across the entire site. I don’t think the users will mind.
Can anyone suggest anything, which is straightforward and future-proof? Preferably, I’d be looking to include it in the theme’s functions.php file. Using htaccess is also possible, but less desirable. Altering core files is a no-no for obvious reasons.
- The topic ‘Disable comments feed(s) to protect a secret category’ is closed to new replies.