Remove comment author link from WordPress helps keep comments form your blog cleaning from spam links left by automated or manual comment spammers without install plugin.
WordPress comments feature allows commenters can add a link to own website. It’s good for those who want to discuss seriously, they deserve backlinks for their websites. But this feature is often misused by spammers to promote their blog or product through spam comments.
This tutorial will help you Remove Comment Author Website Link in WordPress, please follow the steps below:
Open functions.php file in themes folder and add the following code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
| function mytheme_comment( $comment , $args , $depth ) { $GLOBALS [ 'comment' ] = $comment ; ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>"> <div id="comment-<?php comment_ID(); ?>"> <div class ="comment-author vcard"> <?php echo get_avatar( $comment ->comment_author_email, 55 ); ?> <?php printf(__( '<span class="fn">%s</span>' ), comment_author()) ?> <?php $options = get_option( 'sensational' ); if ( $options [ 'mts_comment_date' ] == '1' ) { ?> <p><time><?php the_time( 'F j, Y' ); ?></time></p> <?php } ?> </div> <?php if ( $comment ->comment_approved == '0' ) : ?> <em><?php _e( 'Your comment is awaiting moderation.' ) ?></em> <?php endif ; ?> <div class ="comment-meta commentmetadata"> <?php edit_comment_link(__( '(Edit)' ), ' ' , '' ) ?></div> <?php comment_text() ?> <div class ="reply"> <?php comment_reply_link( array_merge ( $args , array ( 'depth' => $depth , 'max_depth' => $args [ 'max_depth' ]))) ?> </div> </div> <?php } |
If function mytheme_comment already exist in functions.php file, you can find and replace
1
| comment_author_link() |
with
1
| comment_author() |
Next: Open comments.php file in the themes folder, find and replace function:
1
| wp_list_comments(); |
with
1
| wp_list_comments( 'callback=mytheme_comment' ); |
If this is too difficult for you to do, there simply is install plugin Disable Author Url and Comment Links
No comments:
Post a Comment