A form can redirect to specific pages or posts, but if your form is not shown at a fixed URL there is no option to simply reload the page where the form appears.
You can achieve this with the following code, being careful to edit the ID of the form for which this should operate. Note that the form must include a redirect (it doesn’t matter which, we will overwrite it) for the required filter to be triggered.
/** * After form submitted reload the same page */ add_filter('cred_success_redirect', 'tssupp_reload_page', 10, 3); function tssupp_reload_page($url, $post_id, $form_data) { if (in_array($form_data['id'], array(142))) { //Edit the form ID if (isset($_REQUEST['_cred_cred_prefix_cred_container_id'])) { $url = get_permalink($_REQUEST['_cred_cred_prefix_cred_container_id']); } } return $url; }
Let us know if this snippet is not working for you:
This snippet doesn’t work