I have custom account page for user, i want the users who are not logged in site when enter http://example.com/account redirected to a custom login page.
Here My code
function setup_user_panel_url()
{
add_rewrite_rule('account', 'index.php?account=1', 'top');
flush_rewrite_rules();
}
function check_request($query)
{
if (isset($query->query_vars['account'])) {
include USER_PANEL_VIEWS . 'panel.php';
exit();
}
}
is_user_logged_in()
function and then redirect to the non-logged-on users to the custom login page viawp_redirect('http://example.com/account')
.