Require Login Redirect to Login Page
Question
With the following function :
function require_login() {
if ( !is_user_logged_in() ) {
auth_redirect();
}
}
Which action should be used?
add_action('template_redirect', 'require_login');
or
add_action('get_header', 'require_login');
I’ve always used template_redirect in the past but lately it doesn’t seem to always work.
0
login, wp-admin
9 years
2014-07-14T16:01:52-05:00
2014-07-14T16:01:52-05:00 0 Answers
86 views
0
Leave an answer