Skip to content

Instantly share code, notes, and snippets.

@mattonomics
Created October 23, 2012 05:01
Show Gist options
  • Save mattonomics/3936783 to your computer and use it in GitHub Desktop.
Save mattonomics/3936783 to your computer and use it in GitHub Desktop.
P2 Theme Mods
<?php
// find out if they're logged in and send them to the login form if not
add_action('template_redirect', 'deny_phonies');
function deny_phonies() {
if (!is_user_logged_in() && $GLOBALS['pagenow'] !== 'wp-login.php') {
wp_redirect(get_site_url($GLOBALS['blog_id'], 'wp-login.php'));
exit;
}
}
// send users to the main site after login
add_filter('login_redirect', 'redirect_loggedin_phonies');
function redirect_loggedin_phonies() {
return get_site_url();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment