Skip to content

Instantly share code, notes, and snippets.

View gmuehl's full-sized avatar

Guido Mühlwitz gmuehl

View GitHub Profile
@gmuehl
gmuehl / rss-more-tag
Created March 23, 2015 14:25
Truncate RSS-Feed on WordPress-More-Tag
// Place in functions.php
function kmb_rss_teaser( $content ){
$split = preg_split( '#<span id=\"more-\d+\"><\/span>#', $content, 2, PREG_SPLIT_NO_EMPTY );
if ( count( $split == 2 ) ) {
$content = balanceTags( $split[0], true );
}
return $content;
}
add_filter( 'the_content_feed' ,'kmb_rss_teaser' );
add_filter( 'the_excerpt_rss', 'kmb_rss_teaser' );