get_blogaddress_by_domain

Get a full blog URL, given a domain and a path.

Description

(string) get_blogaddress_by_domain( (string) $domain, (string) $path ); 

Returns (string)

Parameters (2)

0. $domain (string)
The domain.
1. $path (string)
The path.

Usage

  1. if ( !function_exists( 'get_blogaddress_by_domain' ) ) { 
  2. require_once ABSPATH . WPINC . '/ms-deprecated.php'; 
  3.  
  4. // The domain. 
  5. $domain = ''; 
  6.  
  7. // The path. 
  8. $path = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = get_blogaddress_by_domain($domain, $path); 
  12.  

Defined (1)

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

/wp-includes/ms-deprecated.php  
  1. function get_blogaddress_by_domain( $domain, $path ) { 
  2. _deprecated_function( __FUNCTION__, '3.7.0' ); 
  3.  
  4. if ( is_subdomain_install() ) { 
  5. $url = "http://" . $domain.$path; 
  6. } else { 
  7. if ( $domain != $_SERVER['HTTP_HOST'] ) { 
  8. $blogname = substr( $domain, 0, strpos( $domain, '.' ) ); 
  9. $url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path; 
  10. // we're not installing the main blog 
  11. if ( $blogname != 'www.' ) 
  12. $url .= $blogname . '/'; 
  13. } else { // main blog 
  14. $url = 'http://' . $domain . $path; 
  15. return esc_url_raw( $url );