Written by: Aleš Sýkora

The Author of Toolset.wiki. Big fan of Toolset plugins and WordPress.

I am big fan of WordPress and Toolset plugins. I have done many projects based on WordPress. I also have experience with online marketing, PPC advertising and SEO. I live in Czech Budweis – the town of Budweiser Budvar breverage in the south of the Czech Republic – the heart of Europe.

I love skateboarding, snowboarding, frisbee, fitness, healthy lifestyle, tattoos, mountain biking and other sports. I enjoy having time with friends with good beer and good music.

Auto login after creating new user with Toolset user form

Last Update: 10. 11. 2019 , Category:

Snippet from our fan, who do not give us his name :-D, just call him Unknown Toolset Fan.

You must update the id to your login form id.

// Auto log-in new user
add_action( 'cred_save_data', 'tssupp_cred_autologin', 10, 2 );
function tssupp_cred_autologin( $post_id, $form_data ){
// Set login form ID (in this case mine is 1187)
if ( 1187 == $form_data['id'] ) {

if ( !empty( $_POST['user_email'] ) && !empty( $_POST['user_pass'] ) ) {

$user = get_user_by( "email", $_POST['user_email'] );

$signon = array(
'user_login' => $user->user_login,
'user_password' => $_POST['user_pass'],
'remember' => true

$login = wp_signon( $signon, false );

if ( is_wp_error($login) ) {
error_log( $login->get_error_message() );

Support Us via our Affiliate link!

Toolset logo WordPress

What to do next?

Need a Toolset License?

Buy via affiliate link!

Looking for a tutorial?

Help other users – Add your snippet!

Join the discussion!