I'm using the following code (found on the WordPress.org site) to modify my (more…) text:

//Modify "read more" text
function modify_read_more_link() {
    return '<a class="more-link" href="' . get_permalink() . '">(Continue…)</a>';
add_filter( 'the_content_more_link', 'modify_read_more_link' );

The code works as expected, in the sense that (more…) is properly replaced by (Continue…), and the link works as intended. However, there is a peculiar issue: The class more-link has disappeared, which means styling doesn't work. I attempted to circumnavigate the issue by adding styling inline (return '<a style="font-size:0.8em;" href="' . get_permalink() . '">(Continue…)</a>';) but that hasn't worked either.

My Question:
Why has the class more-link disappeared, and how can I restore it?

Note: I add the code above to functions.php; I'm not using a child theme.

  • Above code is working as expected. May be some plugin is affecting the hook. Try disabling all plugins. Nov 9 '20 at 5:47

Perhaps there is an issue with the "Ellipsis" HTML character you are using?

function modify_read_more_link() {
    return '<a class="more-link" href="' . get_permalink() . '">( Continue &hellip; )</a>';
add_filter( 'the_content_more_link', 'modify_read_more_link' );
  • Good idea, though it sadly didn't work :( Nov 9 '20 at 10:17
  • Did you try without the round brackets around the text - just using the word "Continue" - for example - no technical reason it should fail, but just wondering..?
    – Q Studio
    Nov 9 '20 at 10:26
  • That didn't work either. Do you happen to know where the whole more-link behavior is stored (i.e. which php file)? I feel as if I'm trying to reinvent the wheel, when I could just go to the original place and alter 6 characters (if I only knew where it was stored) Nov 9 '20 at 10:36
  • 1
    I found the culprit! I've been using the code found on this answer and as a result, the class="more-link" was stripped because of this. I'll mark your reply as an answer, and award you the bounty once the interface allows. Nov 9 '20 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.