wpautop filter breaks ‘read more’ (sort of)
-
The Issue
When you utilize a <!–more–> tag to break up longers posts, the ‘read more’ link is bumped down and forced to a new line. The default WordPress format is to insert a break tag, forcing the ‘read more’ link to a new line. This is fine in some cases, but not all. Some users want the ‘read more’ link immediately after the “excerpt”.The Culprit
The default filter, “wpautop”, somewhat breaks the ‘read more’ functionality for the_content function when you split a post into two parts so that you can display an “excerpt” of each post (instead of the full post) on your blog’s index page stream. Unfortunately, this cannot be easily addressed with a plugin because default filters are deep inside WorPress code.The Solution
Until WordPress addresses this in a future release, here is the fix. The fix essentially removes the offending filter when the post utilizes the <!–more–> tag.File: wp-includes/post-template.php
Line: 217
AFTER ADD:remove_filter('the_content', 'wpautop');
I hope this can be implemented in a future release.
Thanks!
- The topic ‘wpautop filter breaks ‘read more’ (sort of)’ is closed to new replies.