1

I'm trying to remove featured images and captions from my feed and struggling to do it. As another question has identified it is very difficult to format captions and so as a newsletter feed I want to remove them.

I have added the below to functions.php having found it on WordPress forums but it dosn't seem to change anything

/** removes caption from RSS feed Denis 15/08/2014 */
function notags_content_rss($content='')
{
 $content = preg_replace("/\[caption.*\[\/caption\]/", '',$content);
 $content = preg_replace("/\[googlevideo.*\[\/googlevideo\]/", '',$content);
 return $content;
}
add_filter('the_content_rss', 'notags_content_rss');

I have also added the following code to remove the featured image as we use the featured image as the main blog images and this means that we have a duplicate image in the feed.

/** removes featured image from RSS feed Denis 25/08/2014 */
remove_filter('the_content', 'featureimage_for_feeds');

Never touched any PHP before so would appreciate any help or advice that can be given.

Finally I am not 100% sure that I am refreshing the feed correctly after each change to the code. This is what I am doing:

  • Clearing website page cache, CDN etc
  • Changing the number of feed items on settings/Reading to force feed refresh
  • Clearing browser cache
  • Going back to campaign monitor with a new email campaign and reloading the template (which calls the feed) to check results

1 Answer 1

1

Have a look at http://codex.wordpress.org/Customizing_Feeds and try using a template for your feed.

There are a variety of ways to customize your feeds, through the use of third-party software you install and add-on to your WordPress site, or by manually changing the feed templates to meet your needs.

Find a tutorial here http://gregrickaby.com/custom-rss-template-wordpress/. There registering and creating a RSS template is explained in two steps. To begin you'ld maybe simply copy and paste the offered code and customize it to your needs afterwards.

In that example are the following lines you simply have to delete to no longer display the image in your feed:

<image>
    <url><?php echo esc_url( $postimage ); ?>"/></url>
</image>

Maybe Feed Template Customize might help you as well as this plugin modifies RSS feeds and ATOM feeds as you want.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.