Skip Navigation

[Resolved] CRED – success submit redirection

This support ticket is created 7 years, 7 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 -

Supporter timezone: Africa/Cairo (GMT+02:00)

Author
Posts
#436648

I would like to make custom redirection after CRED submit:
1) when user create child CPT after submit go back to parent CPT
2) when user create CTP without parent go back to the page where I insert button linked to CRED form

I was trying to use:
https://toolset.com/documentation/user-guides/cred-api/#csr

add_filter('cred_success_redirect', 'custom_redirect',10,3);
function custom_redirect($url, $post_id, $form_data)
{
    if ($form_data['id']==12)
        return '<em><u>hidden link</u></em>';
 
    return $url;
}

but I am not able to set 'hidden link'; the way to get results - nothing is working for now

I am afraid this code to block to access to wp-admin can cause the problem?

add_action( 'init', 'blockusers_init' );

function blockusers_init() {
    if ( is_admin() && ! current_user_can( 'administrator' ) && 
       ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
        wp_redirect( home_url() );
        exit;
    }
}

but even in admin mode I cannot reach any results

#436759
Screenshot 2016-09-16 at 10.37.53 AM.png

Hi, Thanks for contacting Toolset support forums.

The "cred_success_redirect" was meant to work when the form setting for "After visitors submit this form" is set to "Go to a page..." [Check screenshot].

So if you have it set to any other options, the steps required to fix this issue is:

1. Go to form settings and change "After visitors submit this form" from "Keep displaying this form" to "Go to a Page".
2. Select a Page to redirect to, add make redirection delay 0.
3. Add your code snippet to functions.php in your active theme.
4. Make sure the snippet contains the correct form ID.

Please let me know if that solves your problem.

Thanks.

#436897

Hi Ahmed,
thank you for explanation but on the end I choose other way to do it and it working fine.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.