WordPress filter hook · part of WordPress core
http_request_args
A WordPress core filter that 12 plugins also fire themselves, running on 100K+ sites between them.
“Filters the arguments used in an HTTP request.”
How to use http_request_args
It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'http_request_args', function( $args, $url ) {
// Change $args here.
return $args;
}, 10, 2 );Argument names come from LinkTender's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
12 plugins that fire http_request_args
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
Robin Image Optimizer100,000+ installs
apply_filters( 'http_request_args', [ 'method' => 'POST', 'timeout' => $timeout, 'user-agent' => $this->user_agent(), 'headers' => array_merge( $this->headers(), [ 'Content-Type' => 'multipart/form-data; boundary=' . $boundary, 'X-Trigger' => self::$trigger, 'X-Client-Request-Id' => $file['client_id'] ?? wp_generate_uuid4(), ] ), 'body' => $this->multipart( $file, $boundary ), 'sslverify' => true, 'sslcertificates' => ABSPATH . '... )includes/classes/v2/class-client.php:1289 -
Developer Debug Tools100+ installs
apply_filters( 'http_request_args', [ 'method' => 'GET', 'timeout' => 5, 'redirection' => 5, 'httpversion' => '1.0', 'user-agent' => 'WordPress/' . get_bloginfo( 'version' ) . '; ' . home_url( '/' ), 'reject_unsafe_urls' => false, 'blocking' => true, 'headers' => [], 'cookies' => [], 'body' => null, 'compress' => false, 'decompress' => true, 'sslverify' => true, 'sslcertificates' => ABSPATH . WPINC . '/certificates/ca-bundle.crt'... )inc/hub/pages/tools/security-checks/class-security-checks.php:3660 -
LinkTender10+ installs
apply_filters( 'http_request_args', $args, $url )includes/class-linktender-checker.php:467 -
AdFever for WordPress10+ installs
apply_filters( 'http_request_args', $r, $url )lib/wp-compat/http.php:237 -
Cute MediaInfoFewer than 10 installs
apply_filters( 'http_request_args', $parsed_args, $url )admin/includes/scrap/class-cutemi-wp-http.php:95 -
AI Content BuilderFewer than 10 installs
apply_filters( 'http_request_args', $args, $url )includes/Media/ParallelHttp.php:43 -
AstrologyAPIFewer than 10 installs
apply_filters( 'http_request_args', array( 'sslverify' => true, 'sslcertificates' => ABSPATH . WPINC . '/certificates/ca-bundle.crt', ), $url )includes/class-aapi-client.php:200 -
Lucid Lab Media & Products CleanupFewer than 10 installs
apply_filters( 'http_request_args', $args, $url )includes/class-lucidlab-mpc-crawl-http.php:200 -
TurnKey DirectoriesFewer than 10 installs
apply_filters( 'http_request_args', wp_parse_args(array('timeout' => $timeout, 'redirection' => 0), $defaults), $url )includes/class-turnkeydir-mapillary-api.php:4038 -
LinkSolvaFewer than 10 installs
apply_filters( 'http_request_args', $args, $url )includes/class-http-checker.php:404 -
wpBara AuditFewer than 10 installs
apply_filters( 'http_request_args', [ 'method' => 'GET', 'timeout' => $opts['timeout'], 'redirection' => 5, 'httpversion' => '1.1', 'user-agent' => $opts['user_agent'], 'reject_unsafe_urls' => false, 'blocking' => true, 'headers' => [], 'cookies' => [], 'body' => null, 'compress' => false, 'decompress' => true, 'sslverify' => true, 'sslcertificates' => $bundle, 'stream' => false, 'filename' => null, 'limit_response_size' => $opts... )includes/class-http-batch.php:124 -
OctoPressFewer than 10 installs
apply_filters( 'http_request_args', $args, $url )src/Foundation/Runtime/RequestTickDispatcher.php:152
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.