Created
August 8, 2024 12:54
-
-
Save matty0501/94b5bc41f03eb13edeb1ce484aad7c79 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Gravity Wiz // Gravity Forms // URL Encode Merge Tag Modifier | |
* https://gravitywiz.com | |
* | |
* Use the :url_encode modifier on merge tags to URL encode the value | |
* | |
* this: Advanced Save & Continue | |
* to: Advanced+Save+%26+Continue | |
*/ | |
add_filter( 'gform_merge_tag_filter', function ( $value, $merge_tag, $modifier, $field, $raw_value, $format ) { | |
if ( empty( $modifier ) ) { | |
return $value; | |
} | |
$modifiers = array_map( 'strtolower', explode( ',', $modifier ) ); | |
if ( ! in_array( 'url_encode', $modifiers, true ) ) { | |
return $value; | |
} | |
return urlencode( $value ); | |
}, 10, 6 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment