Hey WP community,
I need some help building a function that will force a certain category to only show excerpts in my RSS Feeds. I have a membership site, and while I am able to protect content directly on the site, the feed is exposed with the software I am using.
I have been able to hack the feed.php file by doing the following:
In /wp-includes/feed-rss2.php I edited line 43 from this:
<?php if (get_option('rss_use_excerpt')) : ?>
to this:
<?php if (get_option('rss_use_excerpt') OR in_category('the-category')) : ?>
However I'd much rather add something to my theme's functions.php file, so whenever I upgrade WordPress I don't forget about making the change again.
I found this code that will HIDE a category from your feed, but I just want to force an excerpt for the category in the feed:
function myFeedExcluder($query) {
if ($query->is_feed) {
$query->set('cat','-12');
}
return $query;
}
add_filter('pre_get_posts','myFeedExcluder');
Any ideas on how to do this? Thanks in advance for any help!!
Adam