Created
July 28, 2017 18:02
-
-
Save leepettijohn/4225a02f0a2060e623788950b080c21d to your computer and use it in GitHub Desktop.
Gravity Forms - Checkboxes to Updating Tags
This file contains 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
<? | |
// see this gist for creating dynamic checkboxes - https://gist.github.com/leepettijohn/28499de95fae967845728ec0be7a43d0 | |
$checktag = 1; //This should stay as 1 | |
$beertag = 16; //This should be the field_id of the checkbox field | |
while (isset($entry["{$beertag}.{$checktag}"])){ | |
if (!empty($entry["{$beertag}.{$checktag}"])){ | |
wp_set_post_terms($new_beer_id,$entry["{$beertag}.{$checktag}"],'post_tag',true); | |
} | |
$checktag++; | |
if ($checktag % 10 == 0){ | |
// for whatever reason, GF doesn't like checkbox ids in multiples of 10 | |
$checktag++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment