Support » Fixing WordPress » How to remove hyperlink from comment date?

  • Resolved deko


    When wp_list_comments() is called from comments.php, it formats the date of each comment as a hyperlink.

    I don’t want the date to be a hyperlink. Is there anyway to prevent this?

    It looks like wp_list_comments() is defined in wp-includes/comment-template.php, but I’m not sure how to modify it to eliminate the date hyprelink formatting.

    Is there an easier way?

Viewing 3 replies - 1 through 3 (of 3 total)
  • See – especially the details about comment callbacks.

    thanks esmi. after reading that page, my impression is that the wp developers hardcoded hyperlinked comment dates in order to provide permalinks to comments.

    reasonable enough. perhaps I should simply style the link so it doesn’t look like a link.

    for those who *really* don’t want hyperlinked comment dates, line 1362 to line 1637 of wp-includes/comment-template.php can be modified to this:

    <div class="comment-meta commentmetadata">
      <?php printf( __('%1$s at %2$s'), get_comment_date(), get_comment_time()) ?>
      <?php edit_comment_link(__('Edit'),'  ','' ); ?>

    which removes the following line of code:

    <a href="<?php //echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">

    along with the closing </a> in the following line.

    this will prevent comment dates from being hyperlinked.

    @deko – Thank you so much for this tip! I spent hours trying to figure this out before I found your post! Your tip worked perfectly!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to remove hyperlink from comment date?’ is closed to new replies.