Celebrate WordCamp Asia! - 30% OFF with coupon WC30 at checkout - Terms

Redirect Users to a URL Using a Query String

Be cautious when using this method because the query string parameter can be changed by the user to any path they wish. For a login form we recommend using this method instead: Redirect Users to the Referring Page After Login

When using the Redirect action in WS Form, you might want to dynamically redirect users to a specific URL by passing the path through a query string parameter.

You can achieve this by setting the URL dynamically using a query variable. Here’s how:

  1. Add a Hidden field to your form (We suggest adding it under the Submit button).
  2. In the Default Value setting, enter: #query_var("r").
  3. Make a note of the Field ID shown in the top right, for example, 123.
  4. Click Save at the bottom.
  5. Click the Actions icon at the top of the page.
  6. Click the Add  icon to add a new action.
  7. Select Redirect from the Action pulldown. A series of settings will appear.
  8. In the URL setting, enter: #field(123) where 123 is the Field ID of the hidden field you added. You can also click the variables icon to the right of the URL setting to find the field variable.
  9. Click Save & Close.

The form will now redirect to whatever the r query string parameter is set to.