Description
The gform_preview_form_link filter allows the admin form preview link to be customized.
Usage
The filter which would run for all forms would be used like so:
add_filter( 'gform_preview_form_link', 'your_function_name' );
Parameters
- $preview_link string
The Form preview link HTML.
Examples
1. Change link text
add_filter( 'gform_preview_form_link', function ( $preview_link ) {
return str_replace( esc_html__( 'Preview', 'gravityforms' ), 'Your custom link text here', $preview_link );
} );
Placement
This code should be placed in the functions.php file of your active theme or a custom functions plugin.
Since
This filter was added in Gravity Forms v2.5.
Source Code
This filter is located in GFCommon::get_preview_link() in common.php.