Redirect after login into Wordpress

Asked

Viewed 437 times

1

I have created a new user type with the buyer function in wordpress whenever a new user is registered the even receives two links, one to change the password and the other that directs to a login screen, I’m having problem in this part, the each registered user with the buyer function Wordpress sends these links, the login when click directs to login screen and when the login is done it redirects to the subscriber panel where it changes the profile and such, only that this buyer permission should be redirected to a specific URL which file is responsible for sending that link so I can change the redirect URL, or is there another solution? how could I do that?

  • Henrique wants to codate this ? or use a plugin ?

  • I don’t want to use plugin no, I was using one and gave problem, I prefer to do on nail even...haha

2 answers

1

jQuery(document).ready(function($){
        $("#loginform").on('submit', function() {
            var input_data = $('#loginform').serialize();
            $.ajax({
                type: "POST",
                url: "<?php echo site_url('wp-login.php','login_post'); ?>",
                data: input_data,
                success: function(msg) {
                    var reg1 = /login_error/g;
                    if (reg1.test(msg)) {
                         $('#message').html("Usuário ou senha incorretos.");
                    } else {
                        window.location = "http://url-que-voce-deseja-enviar-o-usuario.com.br";
                    }
                }
            });
            return false;
        });
    });

1


Browser other questions tagged

You are not signed in. Login or sign up in order to post.