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:

functions.php
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.

  1. Robin Image Optimizer icon 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
  2. Developer Debug Tools icon 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
  3. LinkTender icon LinkTender10+ installs apply_filters( 'http_request_args', $args, $url ) includes/class-linktender-checker.php:467
  4. AdFever for WordPress icon AdFever for WordPress10+ installs apply_filters( 'http_request_args', $r, $url ) lib/wp-compat/http.php:237
  5. Cute MediaInfo icon Cute MediaInfoFewer than 10 installs apply_filters( 'http_request_args', $parsed_args, $url ) admin/includes/scrap/class-cutemi-wp-http.php:95
  6. AI Content Builder icon AI Content BuilderFewer than 10 installs apply_filters( 'http_request_args', $args, $url ) includes/Media/ParallelHttp.php:43
  7. AstrologyAPI icon 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
  8. Lucid Lab Media & Products Cleanup icon Lucid Lab Media & Products CleanupFewer than 10 installs apply_filters( 'http_request_args', $args, $url ) includes/class-lucidlab-mpc-crawl-http.php:200
  9. TurnKey Directories icon 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
  10. LinkSolva icon LinkSolvaFewer than 10 installs apply_filters( 'http_request_args', $args, $url ) includes/class-http-checker.php:404
  11. wpBara Audit icon 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
  12. OctoPress icon 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.