I’ve have a customized be part of web page that known as /be part of/ and the web page id=484 and it makes use of a plugin for the registration perform by merely putting a shortcode on the web page very straight ahead.
I have to mechanically log within the consumer after the register and ship them to a selected web page. So I’ve created a perform which works however, it additionally will get triggered when i am logged in as admin and go so as to add new consumer or use the perform wp_insert_user().
Right here is the code that works however how do I restrict the auto login to solely perform when they’re coming from web page known as ‘be part of’.
perform auto_login_new_user( $user_id ) {
wp_set_current_user($user_id);
wp_set_auth_cookie($user_id, false, is_ssl()) ;
wp_redirect( 'http://instance.com/particular.php' );
exit;
}
add_action( 'user_register', 'auto_login_new_user',10,1 );
Now this code does not work once I inform it to execute on the web page id 484 why?
perform auto_login_new_user( $user_id ) {
if (is_page('484')){
wp_set_current_user($user_id);
wp_set_auth_cookie($user_id, false, is_ssl()) ;
wp_redirect( 'http://instance.com/particular.php' );
exit;
}
}
add_action( 'user_register', 'auto_login_new_user',10,1 );