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.

In a plugin I want to build, it deals with contests. A contest has a date on it. Does WordPress have a feature in it where it can run a piece of code every day without requiring someone to create a cron job? Basically I'm wondering if, when you build a blog with WordPress, if WordPress.org or Automattic automatically pings your site once a day or something like that. Because if that's true, I can hook that event and make it run a contest date check.

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

Check out wp_cron and the cron_schedules filter. There are lots of good tutorials out there like this one from WPTuts or this one from Viper007Bond.

share|improve this answer
    
Okay, so basically WordPress's built-in cron (not the one you can hook up separately through a cron job) is kind of a "hopeful cron", as in it hopes someone visits the site so that the cron runs. And it doesn't appear that sites get pinged back daily unless you set something up (like a Google Alert) to do that. Right? I mean, there's nothing in the WP code that asks Automattic or WordPress.org to ping it once a day, right? –  Volomike May 8 '12 at 2:51
2  
You're right about the "hopeful" cron part, but the big advantage is that it's more "server agnostic" than a normal cron job. There are plugins, such as WP-Cron Control, that try to make up for this, though I've never used them. –  mrwweb May 8 '12 at 3:01
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.