[wp-hackers] Hooking into wp-cron settings?

Chris Scott cjscott69 at gmail.com
Mon Dec 13 15:40:24 UTC 2010


On Mon, Dec 13, 2010 at 10:30 AM, Chip Bennett <chip at chipbennett.net> wrote:
> Is there a hook that would allow one to modify settings in wp-cron.php?
>
> I have an issue with scheduled posts not being published (yes, even in WP
> 3.#). One recommended fix is to change the wp-cron timeout from 0.01s to 5s.
> I'm fine with modifying a core file for testing purposes, but if the change
> resolves the problem, I'd prefer to have a more appropriate means of
> implementing it.

Hi Chip,

You can add a filter on http_request_args and modify the timeout there
if doing cron. e.g. (completely untested)

function my_cron_http_request_args($r) {
     if (defined('DOING_CRON') && DOING_CRON) {
          $r['timeout'] = 5;
     }
     return $r;
}
add_filter('http_request_args', 'my_cron_http_request_args');

Hope this helps.

--
Chris Scott


>
> I know there's the
> cron_schedules<http://adambrown.info/p/wp_hooks/hook/cron_schedules>hook,
> but that appears only to allow creation of cron jobs, not modification
> of the settings in wp-cron itself.
>
> Any ideas?
>
> Thanks!
>
> p.s. I know about the Missed
> Scheduled<http://wordpress.org/extend/plugins/missed-schedule/>Plugin;
> however, it simply takes over the entire publish_future_post
> functionality.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list