Another common problem when talking about WordPress is the Scheduled task, tried many solutions and anything works.
Well, here is a mini-patch that can solve this for now, the first solution if your server (or your hoster´s server) is running under Mod_Security rules.
Short answer: Add this to the to defines in your wp-config.php file:
Really long answer, for masochists: Scheduled posts are not now, and have never been, “broken”. The developers of WordPress cannot fix it because there is nothing to fix.
The problem lies in the fact that your server, for some reason, cannot properly execute the wp-cron process. This process is WordPress’ timing mechanism, it handles everything from scheduled posts to sending pingbacks to XMLRPC pings, etc.
The way it works is pretty simple. Whenever a WordPress page loads, internally WordPress checks to see if it needs to fire off wp-cron (by comparing the current time with the last time wp-cron ran). If it does need to run wp-cron, then it tries to make an HTTP connection back to itself, calling the wp-cron.php file.
This connection back to itself is there for a reason. wp-cron has a lot of work to do, and that work takes time. Delaying the user seeing his webpage while it does a bunch of stuff is a bad idea, so by making that connection back to itself, it can run the wp-cron program in a separate process. Since WordPress itself doesn’t care about the result of the wp-cron, it only waits a second, then goes back to rendering the webpage for the user. Meanwhile, wp-cron, having been launched, does its work until it’s finished or it runs out of execution time.
That HTTP connection is where some badly configured systems fail. Basically, WordPress is acting like a web browser. If your site was http://example.com/blog, then WP will call http://example.com/blog/wp-cron.php to start the process. However, some servers simply can’t do that for some reason. Among the possible reasons:
– Server doesn’t have DNS, and so it can’t figure out who “example.com” is, even though it is *itself*.
– Server administrators, in a misguided attempt at security, have blocked “loopback” requests, so it can’t actually make a call back to itself.
– Server is running something called “mod_security” or similar, which actively blocks the call due to brain-dead configuration.
– Something else.
The point is that for whatever reason, your web server is configured in some non-standard way that is preventing WordPress from doing its job. WordPress simply can’t fix that.
However, if you have this condition, there is a workaround. Add this to the to defines in your wp-config.php file:
This alternate method uses a redirection approach, which makes the users browser get a redirect when the cron needs to run, so that they come back to the site immediately while cron continues to run in the connection they just dropped. This method is a bit iffy sometimes, which is why it’s not the default.
Well, wordpress has another problem with Cron´s activities, so, one of those is the Output time for a task, please, modify it to 20, currently is working with a value of 0.01, that´s a very short time to complete a Cron task. Go to you´r Cron File, and find out the only one valor with 0.01 (or 0,01) then modify it putting 20 or a similar higher valor, then, Cron will have enough time to complete the scheduled tasks, and the programmed jobs will work properly by now on.
Thanks for reading this,