query, $matches)) { $post_ID = $matches[1]; $plink = get_permalink($post_ID); header("HTTP/1.1 301 Moved Permanently"); header("Location: $plink"); exit(); } elseif (preg_match("/^m\=([0-9]{4})([0-9]{2})$/", $wp_query->query, $matches)) { $year = $matches[1]; $month = $matches[2]; $plink = get_settings('home') . "/" . $year . "/" . $month . "/"; header("HTTP/1.1 301 Moved Permanently"); header("Location: $plink"); exit(); } } add_action ('template_redirect', 'ftr_old_plinks_redirect'); ?>