http_request_redirection_count
Filter HookDescription
Filters the number of redirects allowed during an HTTP request.Hook Information
File Location |
wp-includes/class-wp-http.php
View on GitHub
|
Hook Type | Filter |
Line Number | 191 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$redirect_count
|
Number of redirects allowed. Default 5. |
string
|
$url
|
The request URL. |
Usage Examples
Basic Usage
<?php
// Hook into http_request_redirection_count
add_filter('http_request_redirection_count', 'my_custom_filter', 10, 2);
function my_custom_filter($redirect_count, $url) {
// Your custom filtering logic here
return $redirect_count;
}
Source Code Context
wp-includes/class-wp-http.php:191
- How this hook is used in WordPress core
<?php
186 * @since 5.1.0 The `$url` parameter was added.
187 *
188 * @param int $redirect_count Number of redirects allowed. Default 5.
189 * @param string $url The request URL.
190 */
191 'redirection' => apply_filters( 'http_request_redirection_count', 5, $url ),
192 /**
193 * Filters the version of the HTTP protocol used in a request.
194 *
195 * @since 2.7.0
196 * @since 5.1.0 The `$url` parameter was added.
PHP Documentation
<?php
/**
* Filters the number of redirects allowed during an HTTP request.
*
* @since 2.7.0
* @since 5.1.0 The `$url` parameter was added.
*
* @param int $redirect_count Number of redirects allowed. Default 5.
* @param string $url The request URL.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/class-wp-http.php
Related Hooks
Related hooks will be displayed here in future updates.