I have a blog page setup to list posts. The "Read More" link is added by

  global $more;
  $more = 0; 

  the_content('<a href="#" class="button">Read More</a>'); ?>

How do i add the_permalink in where the "#" is without breaking the php?

  • This use of the_content() is not very clean : only the link text should be specified here, without HTML tags. WP might remove the <a> tags. Could you check what outputs exactly in the source code ? Also, the "Read More" link may be handled by javascript in your theme (it's the only reason I see to put a # as the link source), be sure to check this as well. Jul 1, 2013 at 2:45

1 Answer 1


Use get_permalink. Otherwise this is basically a PHP string concatenation question.

the_content('<a href="'.get_permalink().'" class="button">Read More</a>');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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