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