WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to return the comments link instead of echoing it? I've been searching the Codex for a little while now, without being able to find a function that just returns the link and doesn't echo it.


share|improve this question
up vote 0 down vote accepted

Use get_comments_link(), it retrieve the link without echoing it.
This is the function that is used by comments_link().

See also: http://codex.wordpress.org/Function_Reference/comments_link

share|improve this answer
Thanks, I looked on the Codex and it said it was deprecated so I wasn't sure. – Jared Aug 11 '11 at 0:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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