I have a form in Wordpress. When it is submitted, the page redirects to another page. But I want the page to stay the same, and for a modal to appear instead of a page redirect.
The following code is from the functions.php file that handles the form submission.
I'm not sure if this where I would introduce a modal. But this is where the redirect is triggered.
function group_buying_subscription()
{
if( isset( $_POST['set-group-buying-subscription'] ) && !isset( $_POST['email_address'] ) ) {
setcookie( 'your-selected-location', $_POST['deal_location'], time( ) + 24 * 60 * 60 * 30, '/' );
wp_redirect( get_term_link( $_POST['deal_location'], 'deals') );
exit();
}
}
Let me know if you need anything else.
Thanks!