How to Change WordPress Excerpt Length – 4 Easy Ways

How to Change WordPress Excerpt Length, change excerpt length wordpressWordPress is an automatic functioning platform, where a not-tech. Person can create and handle his/her website with basic knowledge. Well, this basic knowledge is not that easy.

Sometimes you have to work on code, but with the advancement in technology and coding techniques know millions of plugins are being introduced.

Show/Hide Table of Contents

You can use then to create a desirable change in your WordPress website. But still, some things could not be done by plugins, then you have to work on code. I know that the coding stuff is a headache, I also feel the same when I think about the code.

Here in this article, I will tell you how to change WordPress excerpt length by using plugin and applying code in your directory files. It’s a default function of WordPress to show the first 55 words of the post in the excerpt section.

That function could be changed by applying some techniques I assure you if you will read this article carefully and pay attention to all the steps, you will not face any problem.

What is the WordPress Excerpt Length?

Most of the websites have the Blog section, these Blog section contains different posts (Articles). To present the posts on the Blog section it’s in the theme’s functionality to show posts in Grid format or Row format. Showing the post in any format, some details of post (Meta Details) are also part of a post on the blog section under the name of that post. It contains “Read More” or “Continue Reading” text with that post’s link.

The question is why we should show these details. The answer is very simple, these details inform the visitor what’s in the post. It develops the interest of a visitor. It’s also good for the SEO of your website. You can change your WordPress blog excerpt length or create a new one by following these simple steps (Given Below).

Ways of WordPress Excerpt Length?

There are 4 ways to change the WordPress excerpt length. You can use any of the ways to perform the change WordPress excerpt length. I will recommend you all to use the plugin what to change the WordPress blog excerpt length.

Because it’s a reliable way to change it, and it’s easy for everyone. Before installing and applying the settings kindly read the plugins instructions, compatibility with WordPress, and people’s reviews so you may not face any problem.

1) Post Screen Options (Excerpt).

2) Post (Insert Read More line).

3) Using Plugin.

4) Applying Code in your Directory files.

Post Screen Options (Excerpt)

By default from WordPress, there is not an option in your post area to add an Excerpt of your post. But you can add it by applying these simple steps. Keep in mind, you have add Excerpts of all posts manually one by one. Because it’s an option for a single post.

1) Login to your “Admin Panel“.

2) Go to your “Posts Section“.

3) Open your desired post to “Edit“.

4) Click on the “Screen Options” at the upper-right corner of your admin panel.

Screen Options in WordPress

5) A drop-down list will be open.

6) Tick the “Excerpt” option.

excerpt field, wordpres screen options, change excerpt length wordpress

7) Now you have a block of excerpt, where you can add your desired excerpt (Try to use your keywords for SEO).

8) Add your details in the “Excerpt Block“.

excerpt block in WordPress, wordpress custom excerpt length

9) Click “Update” and update the post.

10) Visit your blog section and check that post. Your post changed according to your selected excerpts.

Now your desired (Characters, length) excerpt is developed for one post. Follow the same steps for your all posts and add excerpts as you want.

Post (Insert Read More Line)

You can change your default excerpt length with this method also.

1) Login to your “Admin Panel“.

2) Go to your “Posts Section“.

3) Open your desired post to “Edit“.

4) Click on the place (at the end of any lines/words/characters anywhere) in the written post where you want to show “Read More” text to click and get the full post.

5) After deciding the place. Click on “Insert Read More Tag (Shift+Alt+T)“.

Insert read more tag in posts, wordpress limit excerpt length

6) This will add a line of reading more.

7) Now click on “Update” and update your post.

8) Visit your blog section and check that post. Your post changed according to your selected excerpts.

You can follow the same steps for your all posts and change WordPress excerpts length as you want. But if you want to apply desired and equal settings to all the posts then you want to follow other methods (Given Below).

Use of Plugins

There are many plugins to change WordPress excerpt length by characters and words, you can also change the “Read More” text to any other text.

Follow the Steps Below Carefully

1) Login to your Admin Panel.

2) Click on Plugins=> “Add New“.

add a new plugin in WordPress

3) Search for “Advanced Excerpt” plugin.

install advanced excerpt plugin, WordPress plugin install

4) Install and Activate the plugin.

5) Move to “Advanced Excerpt Options” from Settings=>Excerpt.

advanced excerpt options, wordpress blog excerpt length

6) Now you have all the settings for all of your blog posts on one page. Change the numbers in the “Excerpt Length” section and select anyone from the drop-down list (Words, Characters).

7) You can Prevent the cutting of words or sentences at the end of an excerpt, by choosing one of the options “Exact, Exact (count spaces as well), Word, and Sentence“.

8) You can change your default Read More text from the “Read More Link” section and lead it to open in a new window.

9) You can disable these settings from the “Disable On” section for different pages like “Home Page, Posts RSS Feed, Search Archive, Author Archive, Category Archive, Tag Archive, and WooCommerce Products“.

advanced excerpt options, wordpress default excerpt length

10) Save the settings and, Visit your blog section and check that post. Your post changed according to your selected excerpts.

I will recommend you to put the backup of your website, then perform the tests. I will also recommend non-tec. Readers to use plugin for WordPress excerpt length.

Applying Code in Your Directory Files

You can change your excerpt size by decreasing/increasing the “words and character” both. You can perform this magic by adding some code lines in your “functions.php” file.

Modify Excerpt Length

To edit or modify excerpt length, Following code write in “function.php” file in your theme.

// Limit Excerpt length is 20 Words
function mytheme_custom_excerpt_length( $length ) {
return 20;
}
add_filter( ‘excerpt_length’, ‘mytheme_custom_excerpt_length’, 999 );
// Make sure to set priority correctly, such as 999.

Change Excerpt With Words

You can change limits if your excerpt by words. Use this code in “functions.php” file of your theme. You can change the length of words as you want.

// Limit Excerpt Length by number of Words
function excerpt( $limit ) {
$excerpt = explode(‘ ‘, get_the_excerpt(), $limit);
if (count($excerpt)>=$limit) {
array_pop($excerpt);
$excerpt = implode(” “,$excerpt).’…’;
} else {
$excerpt = implode(” “,$excerpt);
}
$excerpt = preg_replace(‘`[[^]]*]`’,”,$excerpt);
return $excerpt;
}
function content($limit) {
$content = explode(‘ ‘, get_the_content(), $limit);
if (count($content)>=$limit) {
array_pop($content);
$content = implode(” “,$content).’…’;
} else {
$content = implode(” “,$content);
}
$content = preg_replace(‘/[.+]/’,”, $content);
$content = apply_filters(‘the_content’, $content);
$content = str_replace(‘]]>’, ‘]]>’, $content);
return $content;
}

Add this code to the file “loop.php” in the directory or where you want to apply these settings of excerpts.

// You can change the words limit
<?php
echo excerpt(30);
?>

Change Excerpt With Characters

If you want to change the length of excerpts according to number of characters, then put these codes in your “function.php” file. You can set your number of characters quantity as you want.

//Limit except length to 125 characters.
// limited excerpt length by number of characters
function get_excerpt( $count ) {
$permalink = get_permalink($post->ID);
$excerpt = get_the_content();
$excerpt = strip_tags($excerpt);
$excerpt = substr($excerpt, 0, $count);
$excerpt = substr($excerpt, 0, strripos($excerpt, ” “));
$excerpt = ‘<p>’.$excerpt.’… <a href=”‘.$permalink.'”>Read More</a></p>’;
return $excerpt;
}

You can change the “Read More” text to any other text. Add this line of code to your loop.php or “index.php” file in the directory, after the title.

// You can change the character value
<?php
echo get_excerpt(125);
?>

How to Excerpt Should Be Written

Excerpts are the definition of the post title. The excerpt describes the purpose of post and grabs the attention of the reader. The written excerpt should be arranged with the beauty of words so the reader push him/her self to click on the “Read more” or “Continue Reading” Text.

The written excerpt should contain the post main keyword and Meta keyword one or two times. This will make your excerpt google friendly and also attract the google to read the article. Using the keywords will increase your chances to rank in google.

Final Thoughts

Changing the excerpt is a need of every blogger who understands what blogging is. You will need to perform these changes because you are using a limited free theme or your theme have very limited customization options. I will recommend you all who are going to use the code in their directories, use a child theme to perform these steps.

If you are using a free theme and want to purchase a new one because of the limitations. I will recommend you to purchase the page builder like Elementor and Divi. By using these builders you can create beautiful and responsive websites.

If you liked my article, share it and help other peoples to solve their problems. If you are still facing any problem or have any question in your mind, feel free to comment below. It’s my pleasure to help you out all.

Leave a Comment