Some people might think it is the number of lines you have to define to edit how long or short your excerpt in your WordPress article. It is not. It is defined by how many words. WordPress by default picks the first 55 words as your excerpt. However, if you wish to edit to make it shorter or longer you can definitely do that.
Apply a filter! Applying a filter to your theme’s functions.php file will prevent overwriting each time you go through a WordPress upgrade.
Edit The Number Of Words For The Excerpt in WordPress
1. Go to your functions.php of your theme template and add the following
add_filter('excerpt_length', 'my_excerpt_length'); function my_excerpt_length($len) { return 75; }
Change 75 to the number you want to use. Now your excerpts will be the length you want!
If you want to customize your excerpt any further, then take a look at the WordPress Codex on the_excerpt.
If you prefer not to use code, because you don’t like to touch code, or may be scared of messing something up on your website, you can use the following plugin – Advanced Excerpt.
Please remember that in applying the code to your functions.php, you will have to carry the code snippet over to new themes if they don’t offer an theme option for adjusting the characters for excerpts. Also, your theme must have the_excerpt template tag in the loop so this feature can work.
Do you use excerpts in your website? Were they built into your theme, or did you have to add the_excerpt template tag to your theme?
Please note, that I’ve removed the old method that I had written in this article, as that method way changed the core files and upgrades will only change it back. Also, it’s not the proper way to edit WordPress Core! (Thanks Mike Little!
Raj says
I guess we can create a child theme in WP and apply these changes over there in order to retain the original settings and go back whenever required. Is there an advantage in having a longer summary?
sandraw2580 says
Really great article.. I’ve always have problem with the wp-includes folder. That why I don’t go there cause I usually make everything look like crap.. But thank you for this tutorial, I’ll try it later.Wish me luck!
Joseph says
It looks confusing but I know i will learn this. I am not techie when it comes to WP but i know i need to learn this .