• Is there a way to make it so that images DO NOT appear in the rss feed?

    Not that image file sizes are that large, but Id like to remove them if I could anyway.

    Thanks for any help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Easiest way is to set feeds to summary display, which will use the_excerpt_rss() template tag, and which by default strips all HTML tags. This is a problem if you want to provide full feeds (just without images), as well as retain the links and other HTML in a post.

    A hack-y solution would be to replace the_content() tag (where it appears in your feed scripts => wp-rss2.php, wp-atom.php and wp-rdf.php, depending on the formats you support):

    <?php the_content('', 0, '') ?>

    with a block of code like this:

    <?php
    $content = preg_replace('/<img[^>]*>/i', '', $post->post_content);
    $content = apply_filters('the_content', $content);
    echo $content;
    ?>

    Thread Starter nluckett

    (@nluckett)

    Thanks Kafkaesqui, that worked wonderfully!

    Glad to hear.

    A note to future readers that I forgot to mention you can replace the_content() with the_content_rss():

    <?php the_content_rss('', 0, '', 0, 2); ?>

    The last argument value (2) is for the ‘encode_html’ parameter. A setting of 2 strips all HTML tags from the post’s content, just as the_excerpt_rss() does. Merely passing along another option…

    Oh, my God!!!
    Thank you, Kafkaesqui, you have resolved a big problem to me. My Joomla was dragging all the images of my WordPress feed and now… :)) thank’s!
    Regards
    Yuri
    _____
    https://karaloka.net

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Removing Images from RSS Feed?’ is closed to new replies.