By default, Fluent Form’s conversational form’s URL looks like this: yourdomain.com/?fluent-form=FORM_ID&form=OPTIONAL_SECURITY_CODE
But if you want to customize it and make it pretty something like yourdomain.com/my-forms/FORM_ID/OPTIONAL_SECURITY_CODE then please follow this tutorial
First copy and paste this code to your theme’s functions.php file or into your custom code snippet plugin
<?php
/*
* Internal Function for Fluent Forms Custom Slug
* Do not EDIT this function
*/
function customFfLandingPageSlug($slug)
{
add_action('init', function () use ($slug) {
add_rewrite_endpoint($slug, EP_ALL);
});
add_action('wp', function () use ($slug) {
global $wp_query;
if (isset($wp_query->query_vars[$slug])) {
$formString = $wp_query->query_vars[$slug];
if (!$formString) {
return;
}
$array = explode('/', $formString);
$formId = $array[0];
if (!$formId || !is_numeric($formId)) {
return;
}
$secretKey = '';
if (count($array) > 1) {
$secretKey = $array[1];
}
$paramKey = apply_filters('fluentform/conversational_url_slug', 'fluent-form');
$_GET[$paramKey] = $formId;
$_REQUEST[$paramKey] = $formId;
$request = wpFluentForm('request');
$request->set($paramKey, $formId);
$request->set('form', $secretKey);
}
});
}
/*
* Creating custom slug for conversational form landing page
*
* my-forms is your custom slug for the form
* if your form id is 123 then the landing page url will be then
* https://your-domain.com/my-forms/123
* if you use Security Code on conversational form then the url will be
* https://your-domain.com/my-forms-x/123/SECURITY-CODE
*
* After paste the code to your theme's functions.php file please re-save the permalink settings
*/
customFfLandingPageSlug('my-forms'); // you may change the "my-forms" for your own page slug
Once you add the code, please feel free to change the ‘my-forms’ to your own slug that you want
- my-forms is your custom slug for the form
- if your form id is 123 then the landing page URL will be then your-domain.com/my-forms/123
- if you use Security Code on conversational form then the URL will be your-domain.com/my-forms/123/SECURITY-CODE
Re-Save Permalink
Please note that once you add the code make sure you re-save your permalink from Settings -> Permalinks (on wp-admin)
That’s it.