Returns an array of URL hosts which are considered to be internal hosts.
Description
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.
Return
string[]
An array of URL hosts.
Hooks fired · 1
One hook fires while wp_internal_hosts() runs, in this order:
4812functionwp_internal_hosts(){4813static$internal_hosts;48144815if(empty($internal_hosts)){4816/**4817 * Filters the array of URL hosts which are considered internal.4818 *4819 * @since 6.2.04820 *4821 * @param string[] $internal_hosts An array of internal URL hostnames.4822 */4823$internal_hosts=apply_filters(4824'wp_internal_hosts',4825array(4826wp_parse_url(home_url(),PHP_URL_HOST),4827)4828);4829$internal_hosts=array_unique(4830array_map('strtolower',(array)$internal_hosts)4831);4832}48334834return$internal_hosts;4835}
History
Introduced in 6.2.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
Parsed data
Generated from the wordpress-develop 6.7.7 tag, from src/wp-includes/link-template.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.