WordPress.org

Ready to get started?Download WordPress

Forums

Tweaking functions.php to limit text shown in RSS feeds? (5 posts)

  1. WPChina
    Member
    Posted 4 years ago #

    How can I use code for a filter in functions.php to limit the characters/text size in my RSS feeds?

    I am trying to use the following code to show 10 words but it is not working:

    function myFilterShortenRSS($query) {
        if ($query->the_content_rss) {
            $query->set('','','10');
        }
    return $query;
    }
    add_filter('pre_get_posts','myFilterShortenRSS');
  2. WPChina
    Member
    Posted 4 years ago #

    Sorry, anybody know the code to correctly make only the first 10 words show in the RSS feed? Or some way to only show the text before the "more" cut-off?

  3. WPChina
    Member
    Posted 4 years ago #

    Any ideas how to cut the RSS feed down in size?

    I am fairly certain about 2 years ago the RSS feed did stop at the < !-- more -- > tag.... but now the summary continues for many more words... I would like to be able to truncate this to whatever I need to shorten it to.

  4. StrangeAttractor
    Member
    Posted 4 years ago #

    Have you looked at this?

    http://codex.wordpress.org/Function_Reference/the_content_rss

    Looks like there's some built-in options to do what you want...

    Just looking into these issues myself, so probably can't offer further help, but thought you might find useful

  5. phattrance
    Member
    Posted 3 years ago #

    i would also like to know how to limit the default wordpress rss to xx words (and still keep the post image)

Topic Closed

This topic has been closed to new replies.

About this Topic