Site logo

Archived topic

How to delete nofollow in internal links?

10 replies · Started by Anna on April 9, 2021

Viewing posts 1–11 of 11

Hi there,

The theme itself doesn't add nofollow to any links by default.

How and where is that link added?

Hi there,

That's added by WordPress core default templates. The theme doesn't control that.

But to help you out:

You can use this filter:
https://developer.wordpress.org/reference/hooks/get_comment_author_link/
https://github.com/WordPress/WordPress/blob/ad48a153873cdef28ab03c54a034de807e729052/wp-includes/comment-template.php#L241

Example:

add_filter( 'get_comment_author_link', function( $return, $author ){
    global $comment;
    if ( !empty( $comment->user_id ) && !empty( get_userdata( $comment->user_id )->ID ) ) {
        $return = sprintf(
            '<a href="%s" rel="external ugc" class="url">%s</a>',
            get_author_posts_url( $comment->user_id ),
            $author
        );
    }
    return $return;
} );

Thanks

Im copy ypur code and past here? Right?

custom code

Im not developer.( Dont understand. I can ask you help for extra charge..?

Thanks

You're welcome

This archived topic is closed to new replies.