wp_login_form() dynamic redirection by anchor

Viewed 39

I am using wp_login_form() and I have a situation that I need to redirect to a specific page after a successful login. Code

<?php
$log_args = array(
        'redirect' => '',
        'form_id' => 'loginform-custom',
        'label_username' => __( 'Email' ),
        'label_password' => __( 'Password' ),
        'label_remember' => __( 'Remember Me' ),
        'label_log_in' => __( 'Log In' ),
        'remember' => true
);
?>

What I need is to fill the 'redirect' key in the array dynamically based on a click of a link/button. If the user clicks on the link1, so it will be redirected to a page1.php, it link2 so redirect to page2.php (after the login)

<a href="#link1" id="btn-test">BUTTON 1</a>
<a href="#link2" id="btn-test">BUTTON 2</a>

I don't know if there is any filter I could do that. Thanks for any help.

0 Answers
Related