Timeline for How do i schedule cron in wordpress for each second?
Current License: CC BY-SA 4.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
S Nov 15, 2021 at 7:38 | history | suggested | Frank | CC BY-SA 4.0 |
wp_cron function new codex link updated.
|
Nov 15, 2021 at 6:58 | review | Suggested edits | |||
S Nov 15, 2021 at 7:38 | |||||
Feb 26, 2013 at 11:39 | comment | added | fischi | let us continue this discussion in chat | |
Feb 26, 2013 at 11:37 | comment | added | Frank | You such a rock star then. Am installing plugin and checking. | |
Feb 26, 2013 at 11:36 | comment | added | fischi | Install a Cron-Overview Plugin where you can see all your Crons. Set the scheduled time to 1 minute, just to see if everything works, and you should see the cron in your Overview list. Can you confirm that? | |
Feb 26, 2013 at 11:35 | comment | added | Frank | But am hitting website each & everysecond. | |
Feb 26, 2013 at 11:32 | comment | added | fischi |
As mentioned, wp_cron just executes IF the page is loaded. So if you set the interval to 1 second, and nothing happens on your site for 1 hour, wp_cron does not autmatically load itself. It is part of the WordPress script, and checks if it has to be executed whenever WordPress is loaded.
|
|
Feb 26, 2013 at 11:28 | comment | added | Frank | Do you know the reason? Why? | |
Feb 26, 2013 at 11:26 | comment | added | fischi | Yeah, that's what i expected - because on your localhost it will not often happen that you load your page every second ;) | |
Feb 26, 2013 at 11:24 | comment | added | Frank |
I have already second option, set corn job on server. I tried above custom recurrence everysecond but its not working though on local-host.
|
|
Feb 26, 2013 at 11:05 | comment | added | fischi |
Yep, that's exactly what that means :) If you really depend on a Script being executed every second (I can't think of a case where this is necessary when nobody visits the site) you should go for a real Cronjob instead of wp_cron .
|
|
Feb 26, 2013 at 10:44 | comment | added | Frank |
Thanks for great knowledge. Thatz means i needs to hit site in every second to run scheduled cron. wp_schedule_event( time(), 'everysecond', 'my_hourly_event');
|
|
Feb 26, 2013 at 9:47 | history | answered | fischi | CC BY-SA 3.0 |