Missed Schedule for wordpress posts due to .htaccess password protection blocking wp-cron.php

I recently set up a private blog that is fully password protected using an .htaccess file. (Users have to enter a username and password to view anything on the blog.) Everything was working well until we tried to set up posts scheduled to publish in the future. They would not post. The dashboard would show “Missed Schedule” and we would have to publish them manually.

After lots of head scratching, I finally figured out what was causing this. Apparently wordpress will call the wp-cron.php file every time a user views a page. HOWEVER, because the web server is doing this, and not the user’s browser, if the wp-cron.php file is protected by a .htaccess user authentication system it will not load (because wordpress doesn’t have the correct username/password!). So none of your scheduled actions will take place.

The solution is to allow (only) that file to be loaded without the normal username/password check in your .htaccess file like this:

#Require username and password for all files!
AuthName "Enter your username and password:"
AuthType Basic
AuthUserFile /home/yourdirectory/.htpasswd
Require valid-user

#Exclude the wp-cron.php file!
<files wp-cron.php>
Order Allow,Deny
Allow from all
Satisfy any
</files>

Of course, if your blog is password protected, the wp-cron.php file won’t get hit until somebody logs in to view the blog…but at that point any tasks that are pending will activate.


0 comments ↓

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment