Created
December 17, 2013 13:47
-
-
Save lknight/8005148 to your computer and use it in GitHub Desktop.
wordpress cluster multi site cron script
copied from http://www.lucasrolff.com/wordpress/why-wp-cron-sucks/
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 | |
require('./wp-load.php'); | |
global $wpdb; | |
$sql = $wpdb->prepare("SELECT domain, path FROM $wpdb->blogs LIMIT 0,300", ''); | |
$blogs = $wpdb->get_results($sql); | |
foreach($blogs as $blog) { | |
$command = "http://" . $blog->domain . ($blog->path ? $blog->path : '/') . 'wp-cron.php?doing_wp_cron'; | |
$ch = curl_init($command); | |
$rc = curl_setopt($ch, CURLOPT_RETURNTRANSFER, FALSE); | |
$rc = curl_exec($ch); | |
curl_close($ch); | |
} | |
/* | |
What you then can do, is to use the command: | |
*/5 * * * * wget -q -O - "http://mydomain.com/wp-cron-multisite.php?doing_wp_cron=`date +\%s`" > /dev/null 2>&1 | |
*/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment