wp_is_internal_link()
Determines whether or not the specified URL is of a host included in the internal hosts list.
No Hooks.
Returns
true|false. Returns true for internal URLs and false for all other URLs.
Usage
wp_is_internal_link( $link );
- $link(string) (required)
- The URL to test.
Notes
- See: wp_internal_hosts()
Changelog
| Since 6.2.0 | Introduced. |
wp_is_internal_link() wp is internal link code WP 7.0
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;
}