Trailing Slash in "Next" Button

Hey there,

I have the following issue. On one of my clients websites we are using Gravityforms. We built the site on a subdomain, and they are referring to it with a different permalink structure. From what the internal IT-guy said, I understood that it is important that all the pages and all the links on our WordPress site are without the trailing slash “/” at the end.

Our form is here:
But it should also work with this URL:

However, the form is stuck if we try to continue to the second step.

So my question is: Is there a way to have the “Next” and “Submit” Buttons link without the trailing slash at the end? Is there an option to change it in a PHP template? How can we make it update-proof?

Thanks a lot,

Hi Dominik,

It sounds like you’re having an issue with the Gravity Forms on your WordPress site when accessed from a different permalink structure. It is essential to ensure that all links on your site do not have a trailing slash at the end, and it’s great that you’re looking for a solution that is update-proof.

One option you can try is to use a filter in your child theme’s functions.php file to modify the URL of the Next and Submit buttons in Gravity Forms. To modify the links, you can use the gform_next_button and gform_submit_button filters.

Here’s an example code snippet you can use in your functions.php file:

add_filter( 'gform_next_button', 'modify_gform_next_button' );
add_filter( 'gform_submit_button', 'modify_gform_submit_button' );

function modify_gform_next_button( $button ) {
    $button = str_replace( '/trailing-slash/', '', $button );
    return $button;

function modify_gform_submit_button( $button ) {
    $button = str_replace( '/trailing-slash/', '', $button );
    return $button;

In the above code, the str_replace() function is used to remove the trailing slash from the URL of the Next and Submit buttons. You’ll need to replace the trailing slash in the above code with the actual trailing slash that appears in the URLs on your site.

This code should be update-proof, as it’s part of your child theme’s functions.php file, which will not be overwritten when you update WordPress or your theme.

I hope this helps! If you have any further questions, please don’t hesitate to reach out.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.