Changing WordPress Excerpt Length and Custom More Text

Most of the WordPress blogger uses excerpt to display a short summary of articles. This snippet able to let your control the length of excerpt, and make a custom more text after the excerpt. It uses add_filter with excerpt_length and excerpt_more. This snippet only work with excerpt generated by WordPress, not working with the optional excerpt field in the backend.


Open functions.php in your template folder, and append this into that file.

function custom_excerpt_length( $length ) {
	return 20;
add_filter( 'excerpt_length', 'custom_excerpt_length');

function custom_excerpt_more( $more ) {
	return 'Read story';
add_filter( 'excerpt_more', 'custom_excerpt_more' );

Share the love

Leave a Comment

Please keep in mind that comments are moderated and rel="nofollow" is in use. You can use [code][/code] if you want to write codes. Don't spam us :) Thanks!