_links_add_base

Callback to add a base url to relative links in passed content.

Description

(string) _links_add_base( (string) $m ); 

Returns (string)

The processed link.

Parameters (1)

0. $m (string)
The matched link.

Usage

  1. if ( !function_exists( '_links_add_base' ) ) { 
  2. require_once ABSPATH . WPINC . '/formatting.php'; 
  3.  
  4. // The matched link. 
  5. $m = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = _links_add_base($m); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/formatting.php  
  1. function _links_add_base( $m ) { 
  2. global $_links_add_base; 
  3. //1 = attribute name 2 = quotation mark 3 = URL 
  4. return $m[1] . '=' . $m[2] . 
  5. ( preg_match( '#^(\w{1, 20}):#', $m[3], $protocol ) && in_array( $protocol[1], wp_allowed_protocols() ) ? 
  6. $m[3] : 
  7. WP_Http::make_absolute_url( $m[3], $_links_add_base ) 
  8. . $m[2];