Filter hook 'allowed_http_origin'

in WP Core File wp-includes/http.php at line 494

View Source

allowed_http_origin

Filter Hook
Description
Changes the allowed HTTP origin result.

Hook Information

File Location wp-includes/http.php View on GitHub
Hook Type Filter
Line Number 494

Hook Parameters

Type Name Description
string $origin Origin URL if allowed, empty string if not.
string $origin_arg Original origin string passed into is_allowed_http_origin function.

Usage Examples

Basic Usage
<?php
// Hook into allowed_http_origin
add_filter('allowed_http_origin', 'my_custom_filter', 10, 2);

function my_custom_filter($origin, $origin_arg) {
    // Your custom filtering logic here
    return $origin;
}

Source Code Context

wp-includes/http.php:494 - How this hook is used in WordPress core
<?php
 489  	 * @since 3.4.0
 490  	 *
 491  	 * @param string $origin     Origin URL if allowed, empty string if not.
 492  	 * @param string $origin_arg Original origin string passed into is_allowed_http_origin function.
 493  	 */
 494  	return apply_filters( 'allowed_http_origin', $origin, $origin_arg );
 495  }
 496  
 497  /**
 498   * Sends Access-Control-Allow-Origin and related headers if the current request
 499   * is from an allowed origin.

PHP Documentation

<?php
/**
	 * Changes the allowed HTTP origin result.
	 *
	 * @since 3.4.0
	 *
	 * @param string $origin     Origin URL if allowed, empty string if not.
	 * @param string $origin_arg Original origin string passed into is_allowed_http_origin function.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/http.php
Related Hooks

Related hooks will be displayed here in future updates.