The CRED User form should redirect to a page on submission to trigger a page reload.
Then add the following code to your theme’s functions.php file or using a plugin such as Code Snippets, editing the ID of the CRED form.
/** * Auto-login new CRED user */ add_action( 'cred_save_data', 'tssupp_cred_autologin', 10, 2 ); function tssupp_cred_autologin( $post_id, $form_data ){ if ( 6 == $form_data['id'] ) { // Edit as required if ( !empty( $_POST['user_login'] ) && !empty( $_POST['user_pass'] ) ) { // get the user credentials from the $_POST object $user = array( 'user_login' => $_POST['user_login'], 'user_password' => $_POST['user_pass'], 'remember' => true ); $login = wp_signon( $user, false ); if ( is_wp_error($login) ) { error_log( $login->get_error_message() ); } } } }
Let us know if this snippet is not working for you:
This snippet doesn’t work