Title: wordpress direct comment link ?
Last modified: February 11, 2020

---

# wordpress direct comment link ?

 *  [devrekli](https://wordpress.org/support/users/devrekli/)
 * (@devrekli)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/wordpress-direct-comment-link/)
 * Hello. I am using this code:
 * > $message .= get_permalink($comment->comment_post_ID). “#comment-” . $comment-
   > >comment_ID.” comment approved: \n\n”;
 * The output of this code is: **site.com/test/#comment-318143**
 * But this is not a direct comment link. It’s wrong. Because I paged the comments.
   It should be output like this.
 * > site.com/test/comment-page-**page number**/#comment-341644
 * I tried this, but it didn’t. How can I do?
 * > <?php echo get_comment_link($comment->comment_ID); ?>
 * thanks

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/wordpress-direct-comment-link/#post-12422430)
 * You should let WordPress build the link: [https://developer.wordpress.org/reference/functions/get_comment_link/](https://developer.wordpress.org/reference/functions/get_comment_link/)
 *  Thread Starter [devrekli](https://wordpress.org/support/users/devrekli/)
 * (@devrekli)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/wordpress-direct-comment-link/#post-12422511)
 * [@joyously](https://wordpress.org/support/users/joyously/)
 * Thanks but I don `t get it. Sorry. How would it be used in this code?
 * > $message .= get_permalink($comment->comment_post_ID). “#comment-” . $comment-
   > >comment_ID.” comment approved: \n\n”;
 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/wordpress-direct-comment-link/#post-12422727)
 * If you read the code for the `get_comment_link` function, you will see that the
   link depends on what page it is on. Even if comments are pages, the first page
   link does not have the page in it. You can use `get_comment_link( $comment );`
   or `get_comment_link();` or pass all of the args for the paging, if you want 
   to. But don’t build the link yourself.
 *  Thread Starter [devrekli](https://wordpress.org/support/users/devrekli/)
 * (@devrekli)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/wordpress-direct-comment-link/#post-12423157)
 * <?php echo get_comment_link($comment->comment_ID); ?>
 * I tried this, but it didn’t.This did not give the comment link.
 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/wordpress-direct-comment-link/#post-12423579)
 * What was the output? If it wasn’t a comment link, perhaps there is something 
   wrong with the input?
 *  Thread Starter [devrekli](https://wordpress.org/support/users/devrekli/)
 * (@devrekli)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/wordpress-direct-comment-link/#post-12434285)
 * [@joyously](https://wordpress.org/support/users/joyously/)
 * Now the problem is solved. Thank you

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘wordpress direct comment link ?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 2 participants
 * Last reply from: [devrekli](https://wordpress.org/support/users/devrekli/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/wordpress-direct-comment-link/#post-12434285)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
