Force wordpress curl to use ipv4

when you need to pass custom parameters to curl in wordpress but still want to use the wordpress functions to detect a transport correctly just can just do the following in you wordpress theme

add_action('http_api_curl', 'my_custom_http_api_curl', 2, 3);

function my_custom_http_api_curl($handle, $r, $url) {
    // here you can add one or more options to the $handle
    curl_setopt($handle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
}
PHP

the code above use the http_api_curl wordpress hook to add new options before calling curl_exec()

Sources:

https://developer.wordpress.org/reference/hooks/http_api_curl/
https://developer.wordpress.org/reference/classes/wp_http/_get_first_available_transport/
https://developer.wordpress.org/reference/functions/wp_remote_request/
https://developer.wordpress.org/reference/classes/wp_http/
https://developer.wordpress.org/reference/hooks/http_api_transports/