Skip to content

Commit

Permalink
Add BasicAuth info to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
A5hleyRich committed Feb 29, 2016
1 parent 5f73a8a commit 2b98d43
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,16 @@ foreach ( $items as $item ) {
Save and dispatch the queue:

`$this->example_process->save()->dispatch();`

### 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](http://codex.wordpress.org/HTTP_API), which requires you to attach your BasicAuth credentials to requests. The easiest way to do this is using the following filter:

```
function wpbp_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);
```

0 comments on commit 2b98d43

Please sign in to comment.