Skip Navigation

[Resolved] Redirect function for the forms not working

This support ticket is created 4 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by jozsefG 4 years, 2 months ago.

Assisted by: Waqar.

Author
Posts
#1807907

Hi Waqar 🙂 🙂
How good to see you. I still need a little help with my Resume form from last week.

I managed to make all the 3 RFG forms to work + the 2 parts of the normal form. The subforms even work from modal. My only problem I could not solve was to reload the page at every save

#1807957
#1808771

Hi,

Thank you for waiting and on my test website, I was able to make this redirection function work like this:


add_filter('cred_success_redirect', 'custom_redirect',10,3);
function custom_redirect($url, $post_id, $form_data)
{
	$form_array = array(123, 456, 789);
	
	if (in_array($form_data['id'], $form_array)) {
		$url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
		return $url;
	}
}

Note: Feel free to replace the comma-separated list "123, 456, 789" with the target form IDs.

regards,
Waqar

#1809777

It works perfectly! My issue is resolved now. Thank you!