wordpress comment website link remove

wordpress comment
wordpress comment

In this article, i will teach you How to Remove Post Author Website Url in Comments without WordPress Plugin, just using the WordPress core add_filter().

You just need to add this PHP Code Snippet into your functions.php


function dez_remove_post_author_weburl($return) {
global $comment, $post;
if( !is_admin() ): //only run outside dashboard  
if ( $comment->user_id == $post->post_author ) {
$author = get_comment_author( get_comment_ID() );
$return = $author; //return post author display name only
return $return;
} else {
return $return; //return default
add_filter( 'get_comment_author_link', 'dez_remove_post_author_weburl');[highlighter]

That’s it, i used is_admin() check to make sure the function run outside dashboard only since we still need all the default core link when editing the comments.

Hope you found this WordPress tips and tutorial useful.

0 CommentsClose Comments

Leave a comment

Newsletter Subscribe

Get the Latest Posts & Articles in Your Email

We Promise Not to Send Spam:)