• 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)
  • Thread Starter devrekli

    (@devrekli)

    @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”;

    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

    (@devrekli)

    <?php echo get_comment_link($comment->comment_ID); ?>

    I tried this, but it didn’t.This did not give the comment link.

    What was the output? If it wasn’t a comment link, perhaps there is something wrong with the input?

    Thread Starter devrekli

    (@devrekli)

    @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.