Skip to content

Instantly share code, notes, and snippets.

@bericp1
Last active August 29, 2015 13:57
Show Gist options
  • Save bericp1/9517716 to your computer and use it in GitHub Desktop.
Save bericp1/9517716 to your computer and use it in GitHub Desktop.
Redirect from a page template to /badge-landing if the query string is empty. Should be placed at the top of the page template, within the PHP tags, below the comment block defining the templates name and whatnot, but above `get_header()` or any other function that echos or outputs anything.
if(!isset($_SERVER['QUERY_STRING']) || trim($_SERVER['QUERY_STRING']) === ''){
header('Location: /badge-landing/');
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment