Created
April 17, 2018 14:09
-
-
Save amon-ra/6bc0cef0fe9b9db3620bf1104ef4f545 to your computer and use it in GitHub Desktop.
Wordpress multisite cron
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 | |
global $multisite_hosts; | |
$multisite_hosts = Array('somosnoticias.dev.entomelloso.oondeo.es','entomelloso.dev.entomelloso.oondeo.es', 'somoscastillalamancha.dev.entomelloso.oondeo.es'); | |
function run_cron(){ | |
global $multisite_hosts; | |
$host=array_pop($multisite_hosts); | |
if (!$host) | |
return; | |
register_shutdown_function('shutdown'); | |
if (!isset($_SERVER['HTTP_HOST'])) { | |
$_SERVER['HTTP_HOST'] = $host; // replace with primary host | |
} | |
require './wp-cron.php'; | |
} | |
function shutdown() | |
{ | |
run_cron(); | |
} | |
run_cron(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Or better:
HTTP_HOST='xxx.es' /usr/bin/php7.0 [web_root]/wp-cron.php