Support » Plugins » Set Cron Job in my plugins

Viewing 3 replies - 1 through 3 (of 3 total)
  • You can use wp_cron but it won’t run until someone visits your page. To get it to run at 30 minute intervals you will need to do something at system level (for a *nix system, use cron), not at the level of WordPress.

    Also, if you want your online webserver to connect to your personal computer, you can’t use ‘localhost’. ‘localhost’ means ‘this computer’. Whatever server is running the script will connect to itself.

    Hey thanks for reply,

    But what client want is that he can install this plugin in any site and will able to set cron job .

    Like I said, you can use wp_cron but it will not trigger until somebody, anybody, loads the site. Otherwise you have to use a system cron job. That is just the way it is. WordPress, or any other PHP web application, doesn’t run in the background all the time like a desktop applications (FireFox, Thunderbird) does. WordPress only runs with a page a loaded. Otherwise, it isn’t running at all. It isn’t ‘sleeping’. It isn’t waiting. It just isn’t running at all. If it isn’t running, it can’t do anything. That is all there is to it.

    PHP and the HTTP protocol itself are stateless. You can’t run a precise cron job given those conditions. You have to wait for someone to access the site, kickstart the system, and then WordPress can check to see if ‘cron’ jobs should be updated. You cannot have WordPress kickstart itself every 30 minutes. You have to use some other mechanism.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Set Cron Job in my plugins’ is closed to new replies.