WordPress – How to change RSS summary excerpt/description length

By default the WordPress RSS summary excerpt length is 55 words.

The steps below detail how to change the summary length to any other number.

  1. Open your themes functions.php file and look for a filter starting with
  2. add_filter( 'excerpt_length',
  3. If you find this, take note of the next part of the filter, for example if you found
  4. add_filter( 'excerpt_length', 'mts_excerpt_length', 20 );
  5. Take note of mts_excerpt_length
  6. Now look for the function called mts_excerpt_length and edit the number inside to change the except length.
  7. For example, here you would change 50
  8. function mts_excerpt_length( $length ) {
     return 50;
    }
  9. If you did not find an existing filter add the following to your functions.php below the <?php
  10. function custom_excerpt_length( $length ) {
    	return 20;
    }
    add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
  11. Save the changes.

Was this article helpful?

Related Articles