Change Excerpt Length in WordPress

Change Excerpt Length in WordPress

Change Excerpt Length in WordPress

WordPress themes display post excerpts on the posts page (the blogs section) or the latest posts section. It shows a certain number of words taken from the beginning of the post. The excerpt is the shorter version of your post, which shows up in the posts or blog section in WordPress.

Choosing the right excerpt length is essential for a nice-looking posts section on the home page or the blog’s archive page. In this article, we will lead you to a trouble-free guide on changing the excerpt length in WordPress.

What is an Excerpt in WordPress?

The excerpt shown in WordPress is the small snippet of your blog post that shows up in the blogs section. The number of words depends primarily on the theme you are using. It’s essential to have an engaging excerpt so that users will click on the link to read the full article or blog post.

In some cases, we must customize the excerpt length as we may not need all the words to display from the passage, set in the default WordPress theme.

What is the Default Length of excerpts in WordPress?

The default length of excerpt in WordPress is “55 words”. When you display a post on WordPress, it shows five primary elements,

  1. The Featured Image of the Post
  2. Post Title
  3. Post Meta Information that includes the Author name, Date, category, and tags
  4. An excerpt of the post
  5. Read More Button

The post excerpt contains 55 words taken from the content unless you have a custom excerpt for that particular post(s). However, you may not require all these 55 words in some cases. Do you want to change the excerpt length and display a customized number of comments for every post sitewide?

Ways to Change Excerpt Length in WordPress

WordPress is packed with features that make managing your website more accessible. One feature is its built-in options for changing the excerpt length of posts. If you’re not familiar with excerpts, they are short previews of blog posts that appear in blog archive pages.

There are many ways to do this, and here are some of the most popular ways to edit the length-

  1. No Coding Required

Using the WordPress Customizer-

If you are a non-technical person who doesn’t know how to add or edit HTML codes, we have an easier solution for you.

  1. i) Log in to your WordPress dashboard and click on customize under the appearance tab.
  2. ii) This is the path to the excerpt function in the customizer,
  • iii) Login to wp-admin>>Appearance>>Customize>>Blog Posts>>Archive Layout

According to your requirement, you can edit the default 55 words to a more suitable word count according to your requirement. When designing the home page or archive page layout, the default 55 words are way too long. So many developers trim them to about 20 and 30 words at maximum. This helps in designing an even row layout (of the same height).

The downside of this method is that the path is not universal, and it differs for different themes. For example, while using the Kadence Theme, and your path to the custom excerpt length will be similar as shown above. This may not be the case if you are using a different theme. So, you have to locate the function in your WordPress customizer.

  1. Using a Custom Excerpt for the Post

Whenever you create a new post, you can add a custom excerpt displayed wherever the post is listed, either in the latest posts section or blogs archive page. Here, you can choose the words you want it to display. There varying functions in different editors-

  • In the Gutenberg block editor, you will find this excerpt function under the featured image section on the right-hand side. You can write the custom excerpt with the desired length of words and characters.
  • In Classic editor, you have to do an extra step where you go the screen options and enable excerpt (this function is disabled by default). Then scroll down to find the excerpt area.

For Example, if you write an excerpt of 30 words, then for that post, the excerpt length will be 30 words. If there is no custom excerpt available for a post, WordPress shows the first 55 words from the beginning of the post.

  1. Using the Read More Element

In WordPress, you can choose to display the read more button under the post excerpt and users may click on this to read the full article. But you can use the “add more” function to customize the length of the excerpt.

The “add more” function divides the content from the rest of the post content, and the content above the add more function is considered the custom excerpt for that particular page or post.

  • In the Gutenberg Block Editor, you can select the “more” element and put it under any paragraph in the article, and WordPress will display all the words above the read more button as the excerpt.
  • In the Classic Editor, you can insert the “Read More “tag under any paragraph, and WordPress will automatically display all words above this element as the excerpt.
  1. Using a Plugin

Easiest thing to do if you don’t find the excerpt length in your WordPress customizer is, installing a plugin called “Advance Excerpts”. You can install this free plugin and control all the settings like the length of the excerpt, read more text, read more links, and many other functions. There are more settings available in the plugin to customize the passages further.

Coding Required

If you are a developer or technically sound, you can change excerpt length by adding some codes to the theme editor. Here are some of the ways you can do it.

  1. Using the WP Trim Excerpt Function

you can use the wp trim excerpt function to modify the length of the excerpt. You have to edit the function.php in the theme editor.  The essential WP Trim excerpt function is-

wp_trim_excerpt( string $text = '', WP_Post|object|int $post = null )

If you want to customize the excerpt length, you have to add a filter and use a hook in the function. For Example, if you want to display only 30 words in the excerpt then the code will be-function

mytheme_custom_excerpt_length( $length ) {
   return 30;
add_filter( 'excerpt_length', 'mytheme_custom_excerpt_length', 999 );

The only downside of using this function is that it makes a sitewide change. However, this is not an ideal function if you want to display a different length on a specific layout.

  1. Using a Custom Function

You can use a custom function in the function.php and edit the length of the excerpt,

The code that needs to be added is as below,

Function new_excerpt_length($length) {
global $post ;
If ($post-> all posts?)
Return 30 ;
return 20 ;
  1. Using a Custom excerpt length Function

You can add a custom counting code inside the loop,

The code that needs to add is,

function custom_excerpt_length($ length)
Static $instance = 0 ;
return ( in_the_loop) ( && 0== $ instance ++) ? 30=20

You can edit the current post function in the wp-query role to customize the excerpt length using the Current Post Function. The code required will be-

Function new_excerpt_length ($length) 
Global $wp_query;
If (0 == $wp_query-. current_post)
Return 30;
Return 20;

You can tweak this code to stop this function from interfering with other queries with similar functions.

How do I set up an auto excerpt in WordPress?

The auto excerpt is by default enabled in some themes, but you can always change it according to your requirement. The easiest way to control this is to go to the WordPress customizer and edit.

How do I turn off excerpts in WordPress?

You can turn off the excerpts from showing in blog pages and archives by disabling the “Show Excerpt” function under the Post archive section.

How do I show excerpts of posts in WordPress?

If the post excerpt is not enabled, you can go to WordPress customizer and enable the “show excerpt” function.

How do I create a custom excerpt in WordPress?

You can create a custom excerpt for each page and post. In the Gutenberg block editor, you can find the add custom excerpt box just under the featured image section on the right-hand side of the screen.

In the classic editor, you have to enable the excerpt function from the screen options and edit the excerpt box.

How do I add read more to excerpt in WordPress?

You can add the read more functions in Gutenberg and the classic WordPress editor. The read more function in Gutenberg Block editor is under the name “more” and “Read more” in the classic editor.


We hope this guide has been helpful! You can take many different approaches to change the excerpt length in WordPress. You may have to try a couple of these methods before finding one that works best for your website.

William Hood

Leave a Reply

Your email address will not be published. Required fields are marked *