Exclude part of a wordpress post from appearing the rss feed -
i want exclude few lines of wordpress posts appearing in rss feed.
for example, if body of post
<embed>some file</embed> hello world
how exclude <embed>some file</embed>
appearing in feed.
to accomplish should use filter remove unwanted elements in post before sent rss feed.
add functions.php register function:
<?php add_filter( "the_content_feed", "filter_away_embed_function" ) ?>
add following code either plugin or functions.php aswell:
<?php function filter_away_embed_function($content) { $content = preg_replace('#(<embed.*?>).*?(</embed>)#', '$1$2', $content) return $content; } ?>
the function strip away text within <embed>
, </embed>
.
Comments
Post a Comment