Quick Tip: WP Cron on HTTP Basic Protected Site

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!

5 thoughts on “Quick Tip: WP Cron on HTTP Basic Protected Site

  1. Pingback: WordPress Cronjob (wp-cron.php) trotz HTTP-Authentifizierung ausführen | kulturbanause® blog

Leave a Reply

Your email address will not be published. Required fields are marked *