Is your site in under BasicAuth? If your site is behind BasicAuth, both async requests and background processes will fail to complete. This is because WP Background Processing relies on the WordPress HTTP API, which requires you to attach your BasicAuth credentials to requests. The easiest way to do this is using the following filter, this filter can be in your theme functions.php file



For HTTP API

function cwgbis_http_request_args( $r, $url ) {
$r['headers']['Authorization'] = 'Basic ' . base64_encode( USERNAME . ':' . PASSWORD );
return $r;
}
add_filter( 'http_request_args', 'wpbp_http_request_args', 10, 2);




For WP Cron

If your site is using basic authentication that also would prevent cron jobs from running. You can resolve that issue by adding the Authorization header to the cron request using the WordPress cron_request filter e.g.

add_filter( 'cron_request', 'cron_request_basic_auth' );
function cwgbis_cron_request_basic_auth( $cron_request ) {
$cron_request['args']['headers']['Authorization'] = 'Basic ' . base64_encode( USERNAME . ':' . PASSWORD );
return $cron_request;
}