How to Avoid Widow “Read More” Links in Post Excerpts

Read more link widow in WordPress excerpts

A “widow” in typography is defined as:

A paragraph-ending line that falls at the beginning of the following page/column, thus separated from the rest of the text.

If you are using the standard inline “Read more” links at the end of post excerpts on index and archive pages, here is a simple filter to ensure that a non-breaking space is added before the “Read more” link:

add_filter('the_content_more_link', 'prepend_non_breaking');
function prepend_non_breaking($more_link) {
	return str_replace(' <a ', '&nbsp;<a ', $more_link);
}

Leave a Reply