I am unable to change the "Read more" text while using the excerpt. I've tried the following code:

 function new_excerpt_more( $more ) {
 return ' <a class="read-more" href="'. get_permalink( get_the_ID() ) . '">
 Custom text</a>';

 add_filter( 'excerpt_more', 'new_excerpt_more' );

And this is how I am printing the excerpt:

 <?php the_excerpt(); ?>

But it doesn't seem to work. Any ideas?

  • Please could you post your whole loop, the_excerpt more text should be just [..] not read more..
    – Matt.C
    Commented Sep 17, 2013 at 17:27
  • are you using any plugins to customize the excerpt. Also, are you sure you are have not manually set excerpt for the post?
    – Virendra
    Commented Sep 17, 2013 at 17:45

1 Answer 1


Try making the post object accessible using global and use get_permalink($post->ID)

function new_excerpt_more( $more ) {
    global $post;
    return '<a class="read-more" href="'. get_permalink($post->ID) . '">Custom text</a>';
add_filter( 'excerpt_more', 'new_excerpt_more' );

Ensure the code is in your functions.php file.

  • Hi @Matt.C! Thanks for your quick reply. I tried your code and still I am unable to customize the "Read more" text.
    – Johann
    Commented Sep 17, 2013 at 16:40
  • I forgot to actually make $post global in my code after mentioning it, sorry, updated answer, possibly try again?
    – Matt.C
    Commented Sep 17, 2013 at 16:45
  • It's not picking up the code at all... this is really weird.
    – Johann
    Commented Sep 17, 2013 at 17:01
  • hmm, are you letting wordpress generate the excerpt from the content, or using an excerpt manually put in for the post?
    – Matt.C
    Commented Sep 17, 2013 at 17:04
  • I'm just using the_excerpt variable to print it.
    – Johann
    Commented Sep 17, 2013 at 17:19

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.