Skip Navigation

[Resolved] CRED redirect a special link

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.

This thread is resolved. Here is a description of the problem and solution.

How to redirect to a specific Visual Editor Front End Link after a CRED form is submitted.

1. You set a redirection in CRED GUI and then you can use a cred_success_redirect filter:

function custom_redirect($url, $post_id, $form_data)
    if ($form_data['id']==12)
        return 'http://newlocation';
    return $url;
add_filter('cred_success_redirect', 'custom_redirect',10,3);

Where return value is a constructed URL as this:

$my_link = ''.$post_id.'&post_type=page';
return $my_link;

Relevant Documentation:

This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.


This topic contains 4 replies, has 2 voices.

Last updated by olegB-2 5 years, 7 months ago.

Assigned support staff: Beda.



I use Visual composer to edit pages in the frontend. I want to use CRED to create pages. I need to immediately after creation / editing page CRED redirect the user to edit frontend mode Visual composer. Link must have the following form (example): hidden link.

This is possible with the plugin Advansed Custom Fields. I raised on their support forum about this topic, please take a look: hidden link. Is this possible with the help of CRED?


You can set a redirect to a existing WP page/Post from within the CRED GUI, but to achieve your specific goal you will need Custom Code.

You can use the CRED API and WordPress API to do this.

As example you can use a cred_submit_complete action.


function my_success_action($post_id, $form_data)
    // if a specific form
    if ($form_data['id']==12)
        // user can overwrite everything here, eg redirection, messages displayed etc..
        // eg redirect regardless of form settings
add_action('cred_submit_complete', 'my_success_action',10,2);

Or, if you set a redirection in CRED GUI (recommended) you can use a cred_success_redirect filter:

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

This is elaborated here:

Please let me know if you have further questions regarding the issue mentioned in this Thread

Thank you for your patience.


Thanks for the tip. But in the code is an example for:

return '<em><u>hidden link</u></em>';

While I need a complex link: hidden link while I need a link with the arguments: vc_action, post_id, post_type. Example: hidden link.

Can you give an example of code with the addition of arguments?


It is custom programming work which is beyond the scope of our support.

At this point I would suggest you consider contacting one of our certified partners from this link:

You will get the custom assistance you need to get on with your project.

As a hint, you need to construct a variable exactly as ACF member suggested.
Then you use those to construct the URL.

$my_link = '<em><u>hidden link</u></em>'.$post_id.'&post_type=page';

return $my_link;

Since $post_id is already passed by the CRED form you don't need to define it.

That above line is how you contract your URL.

Thank you


Thank you!

The forum ‘Types Community Support’ is closed to new topics and replies.