Skip to content

Instantly share code, notes, and snippets.

@gmuehl
Created March 23, 2015 14:25
Show Gist options
  • Save gmuehl/1af4c5370d57adf2666a to your computer and use it in GitHub Desktop.
Save gmuehl/1af4c5370d57adf2666a to your computer and use it in GitHub Desktop.
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' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment