Last active
August 29, 2015 14:22
-
-
Save mikezielonka/14d0d80fd58f278c56bd to your computer and use it in GitHub Desktop.
Filter Images Out of RSS Feeds in WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
just save the file in a directory named "filter-rss-images-out" or just upload the php file to wp-content/plugins in WordPress.