• Hi. I would like my RSS feed for my wordpress site to only show the hyperlinked title like this. Right now it shows the full image and the excerpt. How do I remove the excerpt and the image from my site’s rss feed?

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Moderator bcworkz

    (@bcworkz)

    Feeds may be customized by altering the template used.

    Thread Starter p2tl

    (@p2tl)

    Hi. I am not using a template. THis feed comes automatically from wordpress to create the RSS. I changed my settings in wordpress to excerpt but I want the excerpt removed from my RSS feed. I see many other sites do this. How do I do it?

    Moderator bcworkz

    (@bcworkz)

    All feeds use a template. The default one is /wp-includes/feed-rss2.php. This can be overridden with your own as described in the previously linked doc page. If you only wanted to change the content field of the feed you could use the ‘the_content_feed’ filter to alter the content. You could make it an empty string for example, although it’s probably invalid RSS unless you remove the content XML tags as well.

    The overall site image can be removed without a template override by removing the rss2_site_icon() callback from the “rss2_head” action hook.

    The filters do not address the images you want to remove. I’m not sure where those are even coming from if you are using the default template. The default template doesn’t output any post featured images. Is it possible your theme or one of your plugins has altered the feed template without you realizing it? If so, there could be other filter hooks you might be able to use to alter feed output. Overriding the entire template is always an option, but exactly how depends on how the theme or plugin had overridden the default.

    Thread Starter p2tl

    (@p2tl)

    Hello. Thank you for replying. I do not want to remove the image, I just want to remove the excerpt from my RSS feed and leave the image and hyperlink to my site. How do I do that? This photo is from my feed reader, Inoreader. My site feed is there but my feed shows a post excerpt. I want my feed to show up like this one.

    https://pasteboard.co/qQTmeBuGF7Im.jpg

    Moderator bcworkz

    (@bcworkz)

    The following code will cause the feed’s content field to be removed and the description or excerpt field to be empty (code added to theme’s functions.php):

    add_filter('the_content_feed', '__return_empty_string');
    add_filter('the_excerpt_rss', '__return_empty_string');
    Thread Starter p2tl

    (@p2tl)

    Thank you. I added the code but when I check my RSS feed on inoreader, the feeds still look the exact same. How do I know I did it properly? TheFEISTYNews.Com it should show only image and hyperlinked title.

    Moderator bcworkz

    (@bcworkz)

    You can add “feed/” to your site’s URL in your browser and the XML feed data will be returned for your examination. I just did this for you. The post content has successfully been suppressed, but not the excerpt (referred to as the <description> in XML). I don’t know why adding the empty string filter callback is not working, it works correctly on my site.

    It’s conceivable your theme or plugin is also filtering the_excerpt_rss and overriding our empty string code. We can try having our callback execute later so maybe it’ll have the final say. Modify the_excerpt_rss code like this:
    add_filter('the_excerpt_rss', '__return_empty_string', PHP_INT_MAX );

    If that still has no effect, try flushing any caching that may be in effect. If still no joy, the cause is likely due to your theme or a plugin. Determine which one is responsible. Selectively swap themes (adding our filter code to the new theme’s functions.php) and deactivate plugins until our filter code starts working as expected.

    Thread Starter p2tl

    (@p2tl)

    It’s working! It was the cache! Thank you for your rescue efforts! Been using wordpress since 2012 and there’s still so much to learn.

    Moderator bcworkz

    (@bcworkz)

    You’re welcome.

    there’s still so much to learn

    So true! Even if we were to “learn it all” today, the next major update would introduce a whole new set of things to learn X-)

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Remove Excerpt and Image from RSS feed’ is closed to new replies.