How to remove the read more link in posts

How to remove the read more link in posts

There are cases where you want just a section of the content to appear on the home or category page and that people should click on a link to read the rest of the article. The default WordPress behavior is that if you insert¬† the “read more tag” into the content it will split the content and do just that, display a read more link to the details page. In the PHP code, the content is displayed using this tag: <?php the_content(); ?> However, the read more link will appear in the content (at the end of the text) and you might want to format the way the read more link appears. There are more ways to customize the read more link.

Ways to customize the read more link

  • One way would be to use the excerpt using the PHP code: <?php the_excerpt(); ?> then place the read more link using the permalink like this: ¬†<a href=”<?php the_permalink() ?>” >Read more</a>. This allows you to customize the read more link, place it in a div or span and apply CSS on it. However, using the excerpt has some disadvantages:
    • It strips the HTML content (so the text will appear as plain text) and it strips the images
    • It’s limited to 55 chars so you can’t decide from the content where you want to end the teaser text
  • The other (and better) way is to use the_content and customize the display.
    • One way to remove the read more link is to replace the “read more text” with an empty space like this <?php the_content(“”); ?>
    • The other better way is: <?php the_content(”,FALSE,”); ?>

Enjoy!