Title: Strip image/code from rss feed?
Last modified: September 1, 2016

---

# Strip image/code from rss feed?

 *  [gulliver](https://wordpress.org/support/users/gulliver/)
 * (@gulliver)
 * [10 years ago](https://wordpress.org/support/topic/strip-imagecode-from-rss-feed/)
 * I have a custom feed which uses a manual excerpt – which is identical to the 
   text before the ‘more’ quicktag except that it has one line of code (with an 
   image) removed.
 *     ```
       <img class="pagehead" src="/graphics/main/posts/5736/1.jpg" alt="" />
       ```
   
 * I’m wondering if there’s a semi-auto way to remove that line, and hence save 
   myself the time of composing the excerpt?
 * A preg_replace would probably do it, but I don’t know how to include that in 
   the feed template.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [David Artiss](https://wordpress.org/support/users/dartiss/)
 * (@dartiss)
 * [10 years ago](https://wordpress.org/support/topic/strip-imagecode-from-rss-feed/#post-7488987)
 * There is some excellent detail on how to do this in the codex… [https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content_feed](https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content_feed)
 * You simply need to add your own function, say to functions.php, to intercept 
   the feed before it’s created and perform the `preg_replace` on the feed content.
 *  Thread Starter [gulliver](https://wordpress.org/support/users/gulliver/)
 * (@gulliver)
 * [10 years ago](https://wordpress.org/support/topic/strip-imagecode-from-rss-feed/#post-7488989)
 * Thanks.
    The outline seems simple enough – though I need to read more and experiment
   with exactly what code to use for the replace.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Strip image/code from rss feed?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [gulliver](https://wordpress.org/support/users/gulliver/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/strip-imagecode-from-rss-feed/#post-7488989)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
