large shade tree



Recent Posts

Shade Tree Sites |Building Better Websites

Add Thumbnail Image & Exclude Category from RSS

Add to functions.php to add post thumbnail to RSS feed:

function rss_post_thumbnail($content) {
global $post;
if(has_post_thumbnail($post->ID)) {
$content = '<p>' . get_the_post_thumbnail($post->ID) .
'</p>' . get_the_content();
return $content;
add_filter('the_excerpt_rss', 'rss_post_thumbnail');
add_filter('the_content_feed', 'rss_post_thumbnail');

Add to functions.php to exclude a category from the RSS feed:

// custom feed query
function customFeedquery($query) {
if(is_feed()) {
$query->set('cat','-8'); // exclude category 8
return $query;
add_filter('pre_get_posts', 'customFeedquery');

Source: WPHub