1

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

1 Answer 1

0

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...

5
  • 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? Commented Oct 2, 2013 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. Commented Oct 2, 2013 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... Commented Oct 2, 2013 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? Commented Oct 2, 2013 at 8:25
  • It's very wide question, which I can't answer... Commented Oct 2, 2013 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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