get_allowed_http_origins

Retrieve list of allowed HTTP origins.

Description

(array) get_allowed_http_origins(); 

Returns (array)

Array of origin URLs.


Usage

  1. if ( !function_exists( 'get_allowed_http_origins' ) ) { 
  2. require_once ABSPATH . WPINC . '/http.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = get_allowed_http_origins(); 
  7.  

Defined (1)

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

/wp-includes/http.php  
  1. function get_allowed_http_origins() { 
  2. $admin_origin = parse_url( admin_url() ); 
  3. $home_origin = parse_url( home_url() ); 
  4.  
  5. // @todo preserve port? 
  6. $allowed_origins = array_unique( array( 
  7. 'http://' . $admin_origin[ 'host' ],  
  8. 'https://' . $admin_origin[ 'host' ],  
  9. 'http://' . $home_origin[ 'host' ],  
  10. 'https://' . $home_origin[ 'host' ],  
  11. ) ); 
  12.  
  13. /** 
  14. * Change the origin types allowed for HTTP requests. 
  15. * @since 3.4.0 
  16. * @param array $allowed_origins { 
  17. * Default allowed HTTP origins. 
  18. * @type string Non-secure URL for admin origin. 
  19. * @type string Secure URL for admin origin. 
  20. * @type string Non-secure URL for home origin. 
  21. * @type string Secure URL for home origin. 
  22. * } 
  23. */ 
  24. return apply_filters( 'allowed_http_origins' , $allowed_origins );