Before outputting page content
Note this must be before any html headers are sent (i.e. in php code before html output)
Redirect to a new page
header("Location: index.php");
die();
Reload the current page
header('Location: '.$_SERVER['PHP_SELF']);
die;
Redirect with check you’re not already on target page
if (strpos($_SERVER["REQUEST_URI"], 'home-holding') === False)
{
wp_redirect( home_url( '/home-holding') );
die;
}
If you’ve outputted some page content
JavaScript method
$HtmlOutput .= <<<_END
<script>
window.location = "https://somedomain.com";
</script>";
_END;
Using META tag method
<META HTTP-EQUIV="refresh" content="0;URL=index.php">
