The default excerpt length in WordPress is 55 words maximum and then end abruptly with […]. Now you can control to shorten how many words in excerpt. If you are familiar with WordPress Codex, you know the the_excerpt(); control the excerpt function in index.php or archive.php that can display post excerpt in the homepage or archive page.

How can you change excerpt length?

Simply edit your theme functions file functions.php and add the following code at the bottom just above the closing code ?>.

function new_excerpt_length($length) {
return 30;
}
add_filter('excerpt_length', 'new_excerpt_length');

30 is the number of words that you want to display in the post excerpt. Change the number in your desire. It’s better to backup your theme files first before editing the functions.php, so you have chance to restore it easily. Subscribe to our blog RSS feed for more WordPress tips & tricks.

Do you like this post?

 Subscribe free via RSS, or by Email to get updates.