[WordPress]doing_wp_cronが付いてたらリダイレクト
define(‘ALTERNATE_WP_CRON’, true);の時に発生
if(isset($_GET['doing_wp_cron'])){ header('Location: '.get_current_url(false,array('doing_wp_cron'))); exit; } public function get_current_url($remove_get_query = false,$exclude_keys = array()) { $suffix = $_SERVER['REQUEST_URI']; if($remove_get_query){ $tmp = explode('?',$suffix); $suffix = array_shift($tmp); }else if(!empty($exclude_keys)){ $tmp = explode('?',$suffix); $suffix = array_shift($tmp); $get = get_get_queries($exclude_keys); if(!empty($get)) $suffix .= '?' . http_build_query($get); } return get_base_url($suffix); } public function get_get_queries($exclude_keys = array()) { $result = array(); foreach ($_GET as $key => $value){ if(!empty($exclude_keys) && in_array($key,$exclude_keys)){ continue; } $result[$key] = $value; } return $result; } public function get_base_url($suffix = '') { return (empty($_SERVER["HTTPS"]) ? "http://" : "https://") . $_SERVER["HTTP_HOST"] . $suffix; }