5+ Useful Ways to Limit WordPress Excerpt Length Like a Pro

ways to wordpress limit excerpt lengthAre you looking for the easiest and quickest way to limit WordPress excerpt length, without cracking your head?  Here are 6 practical solutions for everyone who wants to reduce excerpts length in WordPress. This includes a way to limit post excerpts without coding, as well as ways to add a small excerpt_length code snippet to your WordPress theme –functions.php.

WordPress Excerpt

A WordPress excerpt is a summary of a blog post that is displayed in the blog page to make readers skim through all your blog posts and pick what is interesting.

It is important to limit WordPress excerpt length since having long WordPress posts excerpt makes no sense and for the site to have a good layout.

Take my blog as an example, I have limited the post excerpts to a small number of words and used a read more button to make it easier to navigate to the full post. I have also created a numbered WordPress pagination for quick navigation.

Ways to Limit WordPress Excerpt Length

In this post, I want to share with you these 6 best ways that you can employ to limit WordPress excerpt length and make your blog more appealing.

6 Ways Limit Post Excerpt Length in WordPress

As mentioned before; this is tutorial that includes both the code snippets and the other general ways to limit WordPress excerpt length.

So it is easier for you to choose the most suitable method for you to implement on your site. The following are the available options that WordPress users can employ to limit the excerpt length:

  1. Use the custom excerpt metabox that is on WordPress post edit screen to limit WordPress excerpt length by adding your custom excerpt that has preferred number of words.
  2. Using the default WordPress read more tag that is available in your post edit screen tiny MCE buttons to limit the blog post summary with a ‘read more’ tag.
  3. You can install and activate free excerpt WordPress plugin like the advanced excerpt that provides you with several options that you can employ to limit WordPress excerpt length.
  4. You can limit WordPress excerpt length using a filter added to the functions.php
  5. You can write an independent PHP function that will be added to the functions.php to limit WordPress excerpt length by targeting the number of characters in the excerpt.
  6. You can write a custom PHP function and add it to functions.php to limit WordPress excerpt length by reducing the number of words that are in your post excerpt.

All these methods work but the choice depends on your WordPress skill level as well as the goal you want to achieve.

As a personal preference, I tend to stick to the simple options but also I encourage the use of filters and in exceptional cases for WordPress theme developer, they can use the custom PHP functions to limit excerpt length.

WordPress Limit Excerpt Length Code Snippet

The most popular way to limit the excerpt length is to add a code snippet in your theme functions in the file named functions.php.

This code snippet below can be added to any theme and you can adjust the number in the code to match the number of words you want in your excerpt length.

// Filter except length to 55 words.
// limit WordPress excerpt length
function njengah_custom_excerpt_length( $length ) {
return 55;
}
add_filter( 'excerpt_length', 'njengah_custom_excerpt_length', 999 )

Conclusion

In this post we have highlighted the various methods you can use to limit the number of words or the length of WordPress excerpt. Each of these methods have its pros and cons and may apply in different needs but the best way is to add the code snippet I shared above in your themes functions.php file.

Similar Articles