• Resolved andrewkhunn

    (@andrewkhunn)


    I was wondering if someone with better PHP-fu than me could help me craft a filter for functions.php to alter get_comment_author_link to open in a new window?

    My (likely horrible) best guess follows:

    function get_comment_author_link_new() {
    
    	$url = get_comment_author_url();
    	$author = get_comment_author();
    
    	if (empty( $url ) || 'https://' == $url)
    
    		$return = $author;
    
    	else
    
    		$return = "<a href='$url' rel='external nofollow' class='url' target='_blank'>$author</a>";
    
    	return apply_filters('get_comment_author_link_new', $return);
    
    }
    
    add_filter('get_comment_author_link', 'get_comment_author_link_new');
Viewing 1 replies (of 1 total)
  • Thread Starter andrewkhunn

    (@andrewkhunn)

    Solved. I just needed to change:

    return apply_filters('get_comment_author_link_new', $return);

    to

    return $return;

Viewing 1 replies (of 1 total)
  • The topic ‘Comment Author Link in New Window’ is closed to new replies.