wp_internal_hosts

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

WordPress Version: 6.5

/**
 * Returns an array of URL hosts which are considered to be internal hosts.
 *
 * By default the list of internal hosts is comprised of the host name of
 * the site's home_url() (as parsed by wp_parse_url()).
 *
 * This list is used when determining if a specified URL is a link to a page on
 * the site itself or a link offsite (to an external host). This is used, for
 * example, when determining if the "nofollow" attribute should be applied to a
 * link.
 *
 * @see wp_is_internal_link
 *
 * @since 6.2.0
 *
 * @return string[] An array of URL hosts.
 */
function wp_internal_hosts()
{
    static $internal_hosts;
    if (empty($internal_hosts)) {
        /**
         * Filters the array of URL hosts which are considered internal.
         *
         * @since 6.2.0
         *
         * @param string[] $internal_hosts An array of internal URL hostnames.
         */
        $internal_hosts = apply_filters('wp_internal_hosts', array(wp_parse_url(home_url(), PHP_URL_HOST)));
        $internal_hosts = array_unique(array_map('strtolower', (array) $internal_hosts));
    }
    return $internal_hosts;
}

WordPress Version: 6.3

/**
 * Returns an array of URL hosts which are considered to be internal hosts.
 *
 * By default the list of internal hosts is comprised of the host name of
 * the site's home_url() (as parsed by wp_parse_url()).
 *
 * This list is used when determining if a specificed URL is a link to a page on
 * the site itself or a link offsite (to an external host). This is used, for
 * example, when determining if the "nofollow" attribute should be applied to a
 * link.
 *
 * @see wp_is_internal_link
 *
 * @since 6.2.0
 *
 * @return string[] An array of URL hosts.
 */
function wp_internal_hosts()
{
    static $internal_hosts;
    if (empty($internal_hosts)) {
        /**
         * Filters the array of URL hosts which are considered internal.
         *
         * @since 6.2.0
         *
         * @param string[] $internal_hosts An array of internal URL hostnames.
         */
        $internal_hosts = apply_filters('wp_internal_hosts', array(wp_parse_url(home_url(), PHP_URL_HOST)));
        $internal_hosts = array_unique(array_map('strtolower', (array) $internal_hosts));
    }
    return $internal_hosts;
}

WordPress Version: 6.2

/**
 * Returns an array of URL hosts which are considered to be internal hosts.
 *
 * By default the list of internal hosts is comproside of the PHP_URL_HOST of
 * the site's home_url() (as parsed by wp_parse_url()).
 *
 * This list is used when determining if a specificed URL is a link to a page on
 * the site itself or a link offsite (to an external host). This is used, for
 * example, when determining if the "nofollow" attribute should be applied to a
 * link.
 *
 * @see wp_is_internal_link
 *
 * @since 6.2.0
 *
 * @return string[] An array of URL hosts.
 */
function wp_internal_hosts()
{
    static $internal_hosts;
    if (empty($internal_hosts)) {
        /**
         * Filters the array of URL hosts which are considered internal.
         *
         * @since 6.2.0
         *
         * @param array $internal_hosts An array of internal URL hostnames.
         */
        $internal_hosts = apply_filters('wp_internal_hosts', array(wp_parse_url(home_url(), PHP_URL_HOST)));
        $internal_hosts = array_unique(array_map('strtolower', (array) $internal_hosts));
    }
    return $internal_hosts;
}