WordPress Guide : How To Set Excerpt Length In WordPress?

change excerpt length

You may have been adding the read more link using the WordPress editor or your theme is having the inbuilt feature. But what would you do when you want to set WordPress custom excerpt length? Do you know how to set excerpt length in WordPress?

When you add the read more button then WordPress would pick up the first 55 words. We all know that WordPress has a lot to offer. You can alter the word count. You have to edit the WordPress files to do the change.

How To Add WordPress Custom Excerpt length?

As I have described in my earlier post that you can add the theme support to show the excerpt instead of the full post. You know that WordPress runs with the PHP codes and you can alter the codes according to your choice.

Here, I am going to let you know about adding the custom length for the excerpt. If you don’t want to show the 55 words then it is easy to change it.

You have to edit one of the main files of your WordPress theme. There are some steps to follow:-

Step 1:- Login to your cPanel and open the file manager. If you don’t want to use the cPanel then you can use the FTP using the Filezilla or any other tool.

Step 2:- Search for the “wp-content” folder and then find the “themes” folder. If you haven’t moved your website from root directory to any folder then you will find the folder in the root directory( “public_html” ).

wordpress custom excerpt length

And if, you are using multiple websites then find the folder of the addon domain and then search for “wp-content”.

Step 3:- Open the folder of the theme you are using on your website. Search for the “functions.php” file and right-click on the file to edit it.

Step 4:- Just add the code in the file and save.

The code is:-

function custom_post_excerpt() {return: 25; }

add_filter(‘excerpt_length’,’custom_post_excerpt’);

After saving the file, you would notice that now WordPress is showing only the 25 words of your post. You can change the count of the words according to you.

Some people prefer to show 100 words. So just replace 25 with 100 and it would be done. It is always advised that you should show the less except to improve the speed of your website.

And your users would be able to see more no. of posts on one page. Though most of the theme developers prefer to use the default excerpt length. But if you want to change then just use the above-written code.

Are You Going To Change excerpt Length?

It’s the matter of the choice whether you set WordPress custom excerpt length or not. But if you are running a bigger website then reducing the word count may enhance the website speed a little.

There are many ways to change the length of the excerpt and the above-mentioned way is the shortest one with a few lines. I am sure, you won’t need to ask how to set excerpt length in WordPress again. If you face any difficulty and feel free to ask.

If you found this tutorial helpful, connect with us on Twitter, LinkedIn, and Facebook.

by Ravi Chahar

A WordPress Professional and a LinkedIn influencer. A coder by passion and a blogger by choice. WordPress theme development is what he can rock with. He is your WordPress guy who will teach you how to solve WordPress errors, WordPress security issues, theme development, design issues and what not.

4 comments

  1. Hi Ravi,

    I find that when I’m reading blogs an excerpt illustrates a point made in the post. Your eyes naturally go to it and it does create more interest. It does have to be something with less words so the reader can be pulled in.

    Now, that you have shown me how easy it is to do…I have to give it a try. Thanks so much for always teaching us how to do things in such an easy way.

    -Donna

    1. Hey Donna,

      I agree with your point. When we read the excerpt of the post and find something valuable then it catches our attention. It’s important to think about the settings of the excerpt.

      You can change the word count so easily. It’s always good to have you Donna.
      Thanks for the support.
      Have a great day.
      ~Ravi

  2. Hey Ravi,

    Willing to read your excellent post,

    I am regular reader of your post and i really like them most and you know they are very enjoyable and interesting every moment while reading them. This topic is also sounds beneficial for every blogger. You have explored several beneficial tools and tips about WordPress. In this post you have generously shared best tips against adding WordPress custom Excerpt length.

    You have used fantastic steps to add Excerpt length. These steps are really simple and convenient to learn them. For unification or to enhance our website we need to change excerpt length. Great post for better enhancement of knowledge.

    Eventually, Thanks for sharing your valuable post.

    With best regards,

    Amar kumar

    1. Hey Amar,

      It’s always good to hear from you. An excerpt can be adjusted according to your wish. If you want to show the less number of words then it won’t be so hard.

      The main thing is that you should know about the location of the files. In the WordPress directory, you would find many files and folders from which you have to edit the functions.php file.

      Thanks for stopping by.
      Enjoy the day.
      ~Ravi

Leave a Reply

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