Skip to content

Instantly share code, notes, and snippets.

@tomthepythonist
Created February 19, 2010 20:39
Show Gist options
  • Save tomthepythonist/309175 to your computer and use it in GitHub Desktop.
Save tomthepythonist/309175 to your computer and use it in GitHub Desktop.
<?php
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
if (!is_user_logged_in() && $pageURL!=wp_login_url())
{
echo wp_login_url().$_SERVER["QUERY_STRING"];
echo " ".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment