Skip to content

Instantly share code, notes, and snippets.

@maor
Created October 19, 2012 16:02
Show Gist options
  • Save maor/3919023 to your computer and use it in GitHub Desktop.
Save maor/3919023 to your computer and use it in GitHub Desktop.
<?php
/* Plugin Name: P2 Force Login
* Description: Force logged-out users to log-in in order to view the P2
* Author: Maor Chasen
* Author URI: http://maorchasen.com/
* Version: 1.0
*/
function p2fl_force_login() {
is_user_logged_in() || auth_redirect();
}
add_action( 'parse_request', 'p2fl_force_login', 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment