Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
WP Cron with HTTP Basic Authentication
function http_basic_cron_request($cron_request) {
$headers = array('Authorization' => sprintf('Basic %s', base64_encode(WP_CRON_CUSTOM_HTTP_BASIC_USERNAME . ':' . WP_CRON_CUSTOM_HTTP_BASIC_PASSWORD)));
$cron_request['args']['headers'] = isset($cron_request['args']['headers']) ? array_merge($cron_request['args']['headers'], $headers) : $headers;
return $cron_request;
add_filter('cron_request', 'http_basic_cron_request');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment