wp_is_internal_link

The timeline below displays how wordpress function wp_is_internal_link has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.2

/**
 * Determines whether or not the specified URL is of a host included in the internal hosts list.
 *
 * @see wp_internal_hosts()
 *
 * @since 6.2.0
 *
 * @param string $link The URL to test.
 * @return bool Returns true for internal URLs and false for all other URLs.
 */
function wp_is_internal_link($link)
{
    $link = strtolower($link);
    if (in_array(wp_parse_url($link, PHP_URL_SCHEME), wp_allowed_protocols(), true)) {
        return in_array(wp_parse_url($link, PHP_URL_HOST), wp_internal_hosts(), true);
    }
    return false;
}