Created
February 14, 2012 16:55
-
-
Save JPry/1828091 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This is an example of the proper way to take advantage of wp_cron() processes. For more information, | |
* see http://codex.wordpress.org/Function_Reference/wp_cron. | |
* | |
*/ | |
// We use an if statement to see if there is already a scheduled event so that we don't add one for every page view. | |
if ( ! wp_next_scheduled( 'foxyshop_email_cron_test' ) ) { | |
wp_schedule_event( time(), 'hourly', 'foxyshop_email_cron_test' ); | |
} | |
// In order to get our actual function to run, we use add_action() to the name of the event in wp_next_scheduled() | |
add_action( 'foxyshop_email_cron_test', 'foxyshop_email_cron_job' ); | |
/** | |
* This function runs our email cron job | |
* | |
* @uses foxyshop_auto_email_sales_stats() | |
*/ | |
function foxyshop_email_cron_job() { | |
require_once( CHILD_DIR . '/foxyshop/auto-email-script.php' ); | |
foxyshop_auto_email_sales_stats(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment