Will wordpress run cron if I have scheduled emails to send? Seems like if no visit (request) is made to the site, scheduled tasks won’t run and therefore emails won’t be sent eg. hourly.

According to current situation, if there is no visit to the site for few hours ( and than visit is made) than all scheduled emails will be sent at the same time

How can I prevent this, is there a plugin to add cron task?

2 Answers
2

You cannot rely on wp-cron for consistent results so you have to look to the server level. Most enterprise-level WordPress installations need some sort of consistent automation. This is how I automate WordPress in this type of situation.

You will need to add a crontab to the server itself. If you’re running Linux, you can use crontab -e to get to the edit screen.

Then add a simple curl command to hit your site on a regular basis:

0 * * * * curl http://yoursite.com/ >/dev/null 2>&1

This command will run once per hour. The bits at the end send the output to null and removes the email functionality every time the cron runs.

I use this on my sites to get around wp-cron’s fickle ‘scheduling’. If you’re not positive about creating a crontab schedule, check out this handy tool for generating a crontab command. http://www.robertplank.com/cron/

If you’re on a shared host, hopefully you have cPanel which if enabled, will give you a GUI to add a cron job. If for some reason you can’t add a crontab, I would consider finding a host that gives you shell access and allows you the flexibility you need.

I’ve never used a cron hosting service, but you could check it out if your host won’t let you add a crontab. http://www.easycron.com/ is an example of a cron host. (Again, I don’t know the reliability of these services)

Hope this helps you!

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *