[wp-trac] [WordPress Trac] #38680: get_comment_author_link must be target blank

WordPress Trac noreply at wordpress.org
Sat Nov 5 07:10:12 UTC 2016


#38680: get_comment_author_link must be target blank
-------------------------+-----------------------------
 Reporter:  vaibhav8275  |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Comments     |    Version:  4.6.1
 Severity:  normal       |   Keywords:
  Focuses:  template     |
-------------------------+-----------------------------
 In comment-template.php

 get_comment_author_link function must return target='_blank' for comment
 author link, no one likes users leave there website just by clicking
 comment author link.

 {{{#!php
 <?php
 function get_comment_author_link( $comment_ID = 0 ) {
         $comment = get_comment( $comment_ID );
         $url     = get_comment_author_url( $comment );
         $author  = get_comment_author( $comment );

         if ( empty( $url ) || 'http://' == $url )
                 $return = $author;
         else
                 $return = "<a target='_blank' href='$url' rel='external
 nofollow' class='url'>$author</a>";

         /**
          * Filters the comment author's link for display.
          *
          * @since 1.5.0
          * @since 4.1.0 The `$author` and `$comment_ID` parameters were
 added.
          *
          * @param string $return     The HTML-formatted comment author
 link.
          *                           Empty for an invalid URL.
          * @param string $author     The comment author's username.
          * @param int    $comment_ID The comment ID.
          */
         return apply_filters( 'get_comment_author_link', $return, $author,
 $comment->comment_ID );
 }

 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38680>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list