Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a custom post type Events. In that post type, I can schedule events with a date and time. Whenever I publish an event, it will automatically send an email to the users 2 days before the event.

However, I noticed that in order for the script to work, I need to have the wesite running. Is my assumption correct? I can't seem to find anything in the Codex regarding this.

How do I fix this?

I am using a plugin called wp-delayed-mail

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

This plugin uses WordPress CRON API. Its no the same thing as usual CRON jobs available at cPanel dashboard. The difference is in the way how they are executed.

When somebody visits your site, WordPress checks if there is a scheduled job which has to be run, then WordPress runs this job by initiating a separate request to a specific URL. If nobody visits your site, then your CRON jobs won't be run even if they are already overdue...

In other words to run WordPress CRON jobs in time you have to have visitors on your site. Another option would be to ping your site by using special service...

share|improve this answer
    
What part in the plugin code tells me that it uses a certain cron job? Also, "Another option would be to ping your site by using special service..." is this the only option I have? Or are there other ways? –  user1526570 Oct 2 '13 at 8:20
    
Take a look at this line. As you can see it calls wp_schedule_single_event(...) function, which means that WP CRON job is used. –  Eugene Manuilov Oct 2 '13 at 8:23
    
is this the only option I have? Or are there other ways? Maybe... Don't know another way to run WP jobs... –  Eugene Manuilov Oct 2 '13 at 8:25
    
Thanks. How do I make it so that I don't need to have my website active for the script to work? –  user1526570 Oct 2 '13 at 8:25
    
It's very wide question, which I can't answer... –  Eugene Manuilov Oct 2 '13 at 8:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.