# Remove Images From Feed Content

> Strips images and image captions from the content sent in your feeds, keeping feeds light for readers and services that only want the text.

- Type: PHP
- Runs: Run everywhere
- Category: [RSS Feeds](https://wpide.com/library/category/rss/)
- Tags: rss, images, text
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/strip-images-from-feed/

## Code

```php
$wpide_strip_feed_images = function ( $content ) {
    $content = preg_replace( '/<figure[^>]*>\s*(?:<a[^>]*>)?\s*<img[^>]*>\s*(?:<\/a>)?\s*(?:<figcaption.*?<\/figcaption>)?\s*<\/figure>/is', '', $content );
    $content = preg_replace( '/<img[^>]*>/i', '', (string) $content );

    return (string) $content;
};

add_filter( 'the_content_feed', $wpide_strip_feed_images, 30 );
add_filter( 'the_excerpt_rss', $wpide_strip_feed_images, 30 );
```

## Notes

The featured image added by other feed snippets is not affected.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Remove Images From Feed Content" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
