_links_add_base()
Callback to add a base URL to relative links in passed content.
Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.
No Hooks.
Returns
String. The processed link.
Usage
_links_add_base( $m );
- $m(string) (required)
- The matched link.
Notes
- Global. String. $_links_add_base
Changelog
| Since 2.7.0 | Introduced. |
_links_add_base() links add base code WP 6.8.3
function _links_add_base( $m ) {
global $_links_add_base;
// 1 = attribute name 2 = quotation mark 3 = URL.
return $m[1] . '=' . $m[2] .
( preg_match( '#^(\w{1,20}):#', $m[3], $protocol ) && in_array( $protocol[1], wp_allowed_protocols(), true ) ?
$m[3] :
WP_Http::make_absolute_url( $m[3], $_links_add_base )
)
. $m[2];
}