wp_is_internal_link example

$comment = get_comment( $comment_id );

    $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : (string) $comment_id;

    $comment_author_url = get_comment_author_url( $comment );
    $comment_author     = get_comment_author( $comment );

    if ( empty( $comment_author_url ) || 'http://' === $comment_author_url ) {
        $comment_author_link = $comment_author;
    } else {
        $rel_parts = array( 'ugc' );
        if ( ! wp_is_internal_link( $comment_author_url ) ) {
            $rel_parts = array_merge(
                $rel_parts,
                array( 'external', 'nofollow' )
            );
        }

        /** * Filters the rel attributes of the comment author's link. * * @since 6.2.0 * * @param string[] $rel_parts An array of strings representing the rel tags * which will be joined into the anchor's rel attribute. * @param WP_Comment $comment The comment object. */

function _make_clickable_rel_attr( $url ) {
    $rel_parts        = array();
    $scheme           = strtolower( wp_parse_url( $url, PHP_URL_SCHEME ) );
    $nofollow_schemes = array_intersect( wp_allowed_protocols(), array( 'https', 'http' ) );

    // Apply "nofollow" to external links with qualifying URL schemes (mailto:, tel:, etc... shouldn't be followed).     if ( ! wp_is_internal_link( $url ) && in_array( $scheme$nofollow_schemes, true ) ) {
        $rel_parts[] = 'nofollow';
    }

    // Apply "ugc" when in comment context.     if ( 'comment_text' === current_filter() ) {
        $rel_parts[] = 'ugc';
    }

    $rel = implode( ' ', $rel_parts );

    /** * Filters the rel value that is added to URL matches converted to links. * * @since 5.3.0 * * @param string $rel The rel value. * @param string $url The matched URL being converted to a link tag. */
Home | Imprint | This part of the site doesn't use cookies.