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.
Share solution ↓
Link To Answer People are also looking for solutions of the problem: apache/2.4.52 (win64) openssl/1.1.1m php/8.1.2 server at localhost port 80
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.