set post excerpt length to limited characters in wordpress

set post excerpt length to limited characters in wordpress

In wordpress 3.0 limiting the excerpt is very easy. the_excerpt function is very useful and helpful in wordpress. In wordpress limiting the excerpt is very easy. With our code you can set post excerpt length to limited characters in wordpress. the_excerpt function is very useful and helpful in wordpress.

set post excerpt length to limited characters in wordpress

set post excerpt length to limited characters in wordpress
set post excerpt length to limited characters in wordpress

In many wordpress theme we used the excerpt. Many times we need to control excerpt characters as per our wordpress theme requirement. You can easily change the excerpt length using wordpress hook.

You just need to open your functions.php file from your wordpress theme folder and put following code in that.

function change_excerpt_length($length) {
    return 100;
}
add_filter('excerpt_length', 'change_excerpt_length');

This filter is used by wp_trim_excerpt() function. By default the excerpt length is set to return 55 words.

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

Leave a Reply

Your email address will not be published.