// Don't render a link if there is no URL set. if ( ! $url ) { return ''; }
/** * Prepend emails with `mailto:` if not set. * The `is_email` returns false for emails with schema. */ if ( is_email( $url ) ) { $url = 'mailto:' . antispambot( $url ); }
/** * Prepend URL with https:// if it doesn't appear to contain a scheme * and it's not a relative link or a fragment. */ if ( ! parse_url( $url, PHP_URL_SCHEME ) && ! str_starts_with( $url, '//' ) && ! str_starts_with( $url, '#' ) ) { $url = 'https://' . $url; }