Tuesday, 12 September 2017

WP Cron Behind HTTP Basic Authentication

Today I ran into a situation where I needed the default WP Cron processing to work while a site was protected behind HTTP Basic authentication. If you’re not familiar with the way WP Cron works by default, it spawns an HTTP request to example.com/wp-cron.php on page load (given a certain set of conditions) and allows that request to sit and process whatever jobs have been registered. When HTTP Basic authentication is active on the site root, though, the request never gets through to wp-cron.php because it gets intercepted by the web server and blocked (because the request isn’t authenticated). To get around that, add the following code into your wp-config.php file:

Then, download this gist and put it inside of the mu-plugins directory.
That’s it!
Source: https://managewp.org/articles/16093/wp-cron-behind-http-basic-authentication

source https://williechiu40.wordpress.com/2017/09/12/wp-cron-behind-http-basic-authentication/

No comments:

Post a Comment