Read more link is not showing for excerpt

Actually, I think I might be wrong and this isn’t actually a bug. The docs note that the more attribute is designed to specify what text should be displayed after content is trimmed. It’s not intended to be used to add a “read more” link as you and I and some other folks had assumed. It seems even the main developer might have lost sight of this when this user request was implemented last year which hyperlinked the text written inside the more attribute.

This trimming only happens on auto-generated excerpts and only when you specify a max number of words. This explains why it wasn’t getting displayed in your case when you hadn’t specified a max number of words. It also explains why it wasn’t getting displayed on non-auto-generated excerpts since these would never be trimmed and would just display whatever is written in the excerpt field of that post.

So I think 99% of the time you’d want more="..." so that when an auto-generated excerpt gets trimmed it ends with nice ellipses instead of ending mid-sentence. I suppose some languages might not use ellipses on trailing sentences so that attribute exists for those rare cases. And then if you wanted a read-more link, you’d write it the way I suggested with an a tag.

Thanks for bringing that up, I hadn’t really realized why that attribute was there and I had always assumed just like you that it was a slightly weird way to add read more links. So thanks for prompting me to learn something new!

2 Likes