Use excerpt of 150 words in RSS feed, exclude certain posts
-
I would like to provide my blog feed as an official source to a particular site’s news website, however one of their requirements is that the average post excerpt length in the RSS feed is 100 words.
Currently WordPress defaults to an excerpt that is shorter than this, about 50 words. I’d also like to exclude posts that do not have content greater than 150 words, ensuring that I am only ever passing significant content to the news website, once again as per their Ts & Cs.
I’ve looked around for a solution and haven’t turned up many results. I have found a way to change the default excerpt length within a theme here: https://www.ads-software.com/support/topic/231953?replies=6 but I cannot apply that to the RSS.
EDIT: That did work – adding this to the functions.php in the theme:
add_filter(‘excerpt_length’, ‘my_excerpt_length’);
function my_excerpt_length($length) {
return 20; // Or whatever you want the length to be.
}To achieve the exclusion of posts I plan to use a dirty method of placing small posts into a category, hiding that category from listings and excluding it from the feed I provide to the news site. This isn’t very full proof for other contributors though. An automated method would be superior.
- The topic ‘Use excerpt of 150 words in RSS feed, exclude certain posts’ is closed to new replies.