• I installed the Flash video plugin on my blog, and it works great..BUT now the RSS feed displays the .FLV files that are in the post. Anyone can click on the file and download the it from the RSS feed.

    Is there a way to prevent the .flv from appearing in the RSS feed?

Viewing 4 replies - 1 through 4 (of 4 total)
  • I’m not sure if there is a plugin available to do this or not. If there isn’t you can use some content filters on the rss with somethng like this:

    function removeFLV($content) {
      global $wp_query;
      if(is_feed()) {
       //find and replace everything between two indentifier tags with nothing
      }
    }
    add_filter('the_content', 'removeFLV');

    Obviously the above is a really rough example, but I hope that gets ya started.

    I made a quick plugin to remove everything between two tags from a full wordpress feed based on the above. I just tested it and it works through feed readers and feedburner, however, it will still display the hidden information when the feed if viewed directly from the site (ie: when clicking on the feed icon in the address bar in FireFox). I’m working on getting it released now.

    Thread Starter gosnowboard09

    (@gosnowboard09)

    thanks for the reply! Where exactly would I paste that code?

    Also, is the plugin released yet?

    Thanks Again

    Didn’t have time to build a control panel and release it as a plugin. So, if you want to try this quick and dirty method add this to the functions.php file for the theme you are currently using:

    function removeFromFeed($string){
        global $wp_query;
        $start="[start]";
        $end="[end]";
        if(is_feed()){
            $string = " ".$string;
            $ini = strpos($string,$start);
            if ($ini == 0) return "";
            $ini += strlen($start);
            $len = strpos($string,$end,$ini) - $ini;
            $remove =  substr($string,$ini,$len);
            $display = str_ireplace($start.$remove.$end,"",$string);
        }
        else{
            $string = str_ireplace($start,"",$string);
            $string = str_ireplace($end,"",$string);
            $display = $string;
        }
        return $display;
    }
    add_filter('the_content', 'removeFromFeed');

    1. Add to functions.php
    2. Enclose what you want to exclude from your feed in [start] [end] on the html tab of your post
    3. Anything weird happens remove the function from the file.

    Hope that helps.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Preventing .flv file from appearing in RSS feed’ is closed to new replies.