Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save phillipwilhelm/ae2afcd52d9310de7a457fd1d9b5dded to your computer and use it in GitHub Desktop.
Save phillipwilhelm/ae2afcd52d9310de7a457fd1d9b5dded to your computer and use it in GitHub Desktop.
<?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