How To Limit Excerpt Length In WordPress

How you ever wondered that you could limit excerpt length in your WordPress themes and plugins? If you are, then, the answer to this would be, yes, it can be limited as you want it for your site. You just need to follow this tutorial to activate it for your site.

What is the default excerpt length in WordPress?

So, you want to limit excerpt length in WordPress, right? Hence, to limit it, first of all, we should know about what is the excerpt length in WordPress by default. The answer to the default excerpt length would be, 55 words, along with [...] as symbol that there is more content to continue reading for.

Now, you may want to know about when it is really helpful, right? Well, the answer to this would be, to display the post summary in the blog, archive as well as the search pages of your site. But, it is extremely not useful for the single post page, where you may have to display the content of the page.

But, in the case of displaying the summary of the post first and then displaying the whole content afterwards, then, it will be helpful for the single post page too for your site.

How to limit excerpt length in WordPress?

After knowing some of the information regarding the excerpt in WordPress, now why the wait? So, let’s move ahead and limit excerpt length in WordPress.

In order to limit the excerpt length in WordPress, what you have to do is, open up your functions.php file of the theme and then paste the below PHP code in this file:

Here, in the above code as mentioned, you might need to change the value, ie, numeric value to best suite your site requirement.

Now, after you have added the mentioned code in the mentioned file, then, you can see the result of this similar as the below screenshot:

Here, as in the above screenshot, you can clearly see that the excerpt words has been changed to the other as created via the above function. Now, each of the posts or pages, which you create, displaying the excerpt will display this length modified as the post summary.

Lastly, if you add any of the manual excerpt for the posts added in your site, then, this functionality will not take effect and thus, making it more dynamic, since, you can show whatever you like as summary for your site for the particular posts in your site. You can find more information about adding manual excerpt here.

Conclusion

If you have followed up this tutorial properly and became successful on about how to limit excerpt length in WordPress, then, we can assume that you are more familiar on this feature than before. But, if you are unsuccessful on this and want more information regarding this, then, you can comment us in the comment box below and we will follow it up.

, , , , , , , , , , , , , , , , , ,

Post navigation

Bishal Napit

Bishal Napit is a WordPress theme developer from Tansen, Palpa, with a passion to learn more on WordPress.

Leave a Reply