public static function swpm_login($user, $pass, $rememberme = true) { if (is_user_logged_in()) { $current_user = wp_get_current_user(); if ($current_user->user_login == $user) { return; } } $user = wp_signon(array('user_login' => $user, 'user_password' => $pass, 'remember' => $rememberme), is_ssl()); if (is_a($user, 'WP_User')) { wp_set_current_user($user->ID, $user->user_login); } do_action('swpm_after_login'); if (!SwpmUtils::is_ajax()) { wp_redirect(site_url()); exit(0); } }