Skip to content

Instantly share code, notes, and snippets.

@mikezielonka
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikezielonka/14d0d80fd58f278c56bd to your computer and use it in GitHub Desktop.
Save mikezielonka/14d0d80fd58f278c56bd to your computer and use it in GitHub Desktop.
Filter Images Out of RSS Feeds in WordPress
<?php
/*
Plugin Name: Filter Images Out of RSS Feeds
Description: Filters images out of the content in rss feeds.
Version: 0.1-alpha
Author: Tuna Traffic
Author URI: http://tunatraffic.com
*/
add_filter( 'the_content', 'rss_filter_img' );
function rss_filter_img( $content ) {
if( is_feed() ) {
$content = preg_replace('/<a[^>]+.<img[^>]+.<\/a>/','', $content);
$content = preg_replace('/<img[^>]+./','', $content);
return $content;
}
}
@mikezielonka
Copy link
Author

just save the file in a directory named "filter-rss-images-out" or just upload the php file to wp-content/plugins in WordPress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment