block_local_requests
Filter HookDescription
Filters whether to block local HTTP API requests. A local request is one to `localhost` or to the same host as the site itself.Hook Information
File Location |
wp-includes/class-wp-http.php
View on GitHub
|
Hook Type | Filter |
Line Number | 918 |
Hook Parameters
Type | Name | Description |
---|---|---|
bool
|
$block
|
Whether to block local requests. Default false. |
Usage Examples
Basic Usage
<?php
// Hook into block_local_requests
add_filter('block_local_requests', 'my_custom_filter', 10, 1);
function my_custom_filter($block) {
// Your custom filtering logic here
return $block;
}
Source Code Context
wp-includes/class-wp-http.php:918
- How this hook is used in WordPress core
<?php
913 *
914 * @since 2.8.0
915 *
916 * @param bool $block Whether to block local requests. Default false.
917 */
918 return apply_filters( 'block_local_requests', false );
919 }
920
921 if ( ! defined( 'WP_ACCESSIBLE_HOSTS' ) ) {
922 return true;
923 }
PHP Documentation
<?php
/**
* Filters whether to block local HTTP API requests.
*
* A local request is one to `localhost` or to the same host as the site itself.
*
* @since 2.8.0
*
* @param bool $block Whether to block local requests. Default false.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/class-wp-http.php
Related Hooks
Related hooks will be displayed here in future updates.