Skip to content

Instantly share code, notes, and snippets.

@amon-ra
Created April 17, 2018 14:09
Show Gist options
  • Save amon-ra/6bc0cef0fe9b9db3620bf1104ef4f545 to your computer and use it in GitHub Desktop.
Save amon-ra/6bc0cef0fe9b9db3620bf1104ef4f545 to your computer and use it in GitHub Desktop.
Wordpress multisite cron
<?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();
?>
@amon-ra
Copy link
Author

amon-ra commented Apr 17, 2018

Or better:

HTTP_HOST='xxx.es' /usr/bin/php7.0 [web_root]/wp-cron.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment