The gform_preview_form_link filter allows you to customize the admin form preview link in Gravity Forms.
Usage
To use this filter for all forms, add the following code:
add_filter('gform_preview_form_link', 'your_function_name');
Parameters
- $preview_link (string) – The form preview link HTML.
More information
See Gravity Forms Docs: gform_preview_form_link
Examples
Change the link text
Replace the default ‘Preview’ text with custom text for the form preview link:
add_filter('gform_preview_form_link', function ($preview_link) { return str_replace(esc_html__('Preview', 'gravityforms'), 'Your custom link text here', $preview_link); });
Place this code in the functions.php
file of your active theme or a custom functions plugin.
Note: This filter was added in Gravity Forms v2.5 and is located in GFCommon::get_preview_link()
in common.php
.