// Enter the ID of the form at the end of the 'gform_confirmation_ID' filter // In this example, the function will only run on the form with the ID of 1 add_filter( 'gform_confirmation_1', 'fivetwelve_custom_url_confirmation_queries', 10, 4 ); function fivetwelve_custom_url_confirmation_queries( $confirmation, $form, $entry, $ajax ) { if ( isset( $confirmation['redirect'] ) ) { // Set the root URL for the site $url = home_url( '/' ); // Populate an array with our form entries $stats = array( 'product_category' => rgar( $entry, '5' ), // Assign the value of input 5 to this variable 'product_name' => rgar( $entry, '6' ), // Assign the value of input 6 to this variable 'variable_one' => rgar( $entry, '7' ), // Assign the value of input 7 to this variable 'variable_two' => rgar( $entry, '8' ), // Assign the value of input 8 to this variable ); // Create the redirect URL with the form inputs, and include query parameters $confirmation = array( 'redirect' => $url . '/' . $stats["product_category"] . '/' . $stats["product_name"] . '/?var1=' . $stats["variable_one"] . '/&var2=' . $stats["variable_two"] ); } return $confirmation; }