How to change Excerpt length in Wordpress

change excerpt length wordpressIf you are using Wordpress as your blogging platform, there may be a common and an annoying problem to you. It is the popular question “how to change excerpt length in wordpress”. Yes, that’s why you are reading this :) I have good news for you. You will not have to worry about how you can change the excerpt length in wordpress anymore. Here I have brought the solution. It is super easy. If you are in a hurry, and want the solution immediately, Click here to Jump direct to the solution! I know all my readers will not be the same. Some may be having the problem, and some may not. But all of them are reading this article. So I am writing for everyone. If you are just curious about this Wordpress issue, please keep on reading :) So as I said, sometimes you may never have had this problem before. And you may even have no idea about Wordpress. That’s not a problem. If you want to know what I am talking about, you are also welcome to keep reading.

So, what is Wordpress?

Ok, Wordpress is one of the most popular CMS (Content Management Systems) being used by many web developers to build blogs and websites. Wordpress is so user friendly, that even a person who has no knowledge in Web Development also can easily manage a website by himself / herself.

What is an excerpt? Where the excerpt is located?

Excerpt, by the meaning of the word itself, the excerpt means an extraction of a piece of text from your blog articles. Simply, it is a small selection of the content within your blog post. Excerpts are located in the Blogs page of your Wordpress blog. When you check the blog page of a website, you can see the titles and a small paragraph under each of the titles, with a link to the Full Blog Post. This small paragraph is called the excerpt.

Why you need an excerpt?

Personally I think it is very much important to set up a blog with excerpts. The reason as I am seeing is, a Blog is a place which gets updated frequently with fresh contents. Then it is obvious that many people are visiting the blog to read the articles. If you are displaying the whole article content without excerpts, and you are having 05 blog posts per page, the page is going to be very lengthy, causing the page to load very slower. Besides, the visitors may be interested in different topics, and they may be seeking the right article for them. If so, you are going to lose the readers. Nobody is going to read lengthy articles just to find whether it matches their interest or not. But simply by having a blog post page with excerpts, you can display many number of blog posts in a single page. Also it will reduce the page load time. And also it makes easier for people to find the right article by reading the title and the excerpt only.

What is the problem with the current excerpt length in Wordpress?

If you do not have any problem with the current excerpt length, then everything is OK. But the most common problem people having with the Wordpress excerpt is the length of it. By default, the Wordpress excerpt length is 55 words. Some people find this too lengthy and some finds it is very short. Whatever the condition you are in, you can change the excerpt length as you wish. Being too short, the excerpt makes the page looks emptier. On the other hand, being too lengthy will make it appear more crowded, and it will also make the content unclear for the visitors. So you must be careful when selecting the right excerpt length for your blogs. First experiment with few variant number of words and come to the final value. It will help you to increase your page views as well.

How to change the Wordpress excerpt length?

The only option available at the moment for this is through editing the source code. Wordpress development team has not included an option within the admin backend to change this value. But it is not a problem at all. You can do it yourself. Just Go to your template Options, and Click on Edit Files. Then under that, on the right hand side (most probably) you will see the list of files being used by the template. Scroll down and select “functions.php” file. Click on it so that it will be open in the text box for you to edit. Then simply paste the following code within the functions.php file. And you have done changing the Wordpress excerpt length.

function custom_excerpt_length( $length )
 return 20;

add_filter( 'excerpt_length', 'custom_excerpt_length', 999 ); 

Be sure to paste the code as it is, and
then change the values accordingly. All you need to do is change the above ‘20’ value to the number you want. Also make sure you are pasting the code within the php tags.
Warning: It is always advised to get a backup of the files you are editing so that you can replace it with the original file if anything went wrong. In the meantime, it is highly advised to always do the editing of files through FTP. In case you have made any code incorrect, there is a possibility to get the site to halt working. If you are unsure about what you are doing, please seek the advice of a person who knows about using FTP, coding etc. This is for your own good :)
I hope you enjoyed reading the article. Please leave your comments and ideas about this article, whether it was useful, or have you learnt anything from this. Also please add a comment if you need any help in changing the above codes.


  1. Thanks for this article have not only explained how to do this, but you have also explained about everything, really easy to understand. good luck.