Created
September 6, 2016 19:51
-
-
Save phillipwilhelm/ae2afcd52d9310de7a457fd1d9b5dded 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 | |
// CREDIT: http://pastebin.com/Ju78M8Ax | |
// exclude field from {all_fields} merge tag by adding | |
// :exclude to merge tag | |
add_filter( 'gform_merge_tag_filter', 'exclude_from_all_fields', 10, 4 ); | |
function exclude_from_all_fields ( $value, $merge_tag, $options, $field ) { | |
$options_array = explode ( ",", $options ); | |
$exclude = in_array ( "exclude", $options_array ); | |
// if a field has the CSS Class Name gf_exclude the field will be excluded from the {all_fields:exclude} merge tag | |
if ( $merge_tag == "all_fields" && $exclude == true && $field["cssClass"] == "gf_exclude" ) | |
return false; | |
else | |
return $value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment