WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to limit the excerpt for RSS feeds? (2 posts)

  1. e-sushi
    Member
    Posted 3 years ago #

    Hey people!

    To keep it short: I'm using this in the "functions.php" of my theme to limit the "regular excerpt" for my category pages:

    function my_excerpt_length($length) {
    	return 32;
    }
    add_filter('excerpt_length', 'my_excerpt_length');

    Is there any similar functionality to limit the excerpt for RSS feeds? Since the "excerpt_length" filter does not seem to catch on in feeds at all.

    Tnx for all feedback you can provide...

  2. e-sushi
    Member
    Posted 3 years ago #

    Quick an simple answer, sharing my solution with those looking for the same thing:

    function my_feed_modder($content) {
        $content = explode(' ',$content);
    
        $content = array_slice($content, 0, 4);
        // where 4 is the number of words to show
    
        $content = implode(' ',$content);
      return $content;
    }
    add_filter('the_excerpt_rss', 'my_feed_modder');

Topic Closed

This topic has been closed to new replies.

About this Topic