<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: Custom taxonomy checkbox code</title>
		<link>https://legacy.forums.gravityhelp.com/topic/custom-taxonomy-checkbox-code</link>
		<description>Gravity Support Forums Topic: Custom taxonomy checkbox code</description>
		<language>en-US</language>
		<pubDate>Thu, 23 Apr 2026 00:21:35 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/custom-taxonomy-checkbox-code" rel="self" type="application/rss+xml" />

		<item>
			<title>Anonymous on "Custom taxonomy checkbox code"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/custom-taxonomy-checkbox-code#post-16798</link>
			<pubDate>Fri, 21 Jan 2011 19:28:57 +0000</pubDate>
			<dc:creator>Anonymous</dc:creator>
			<guid isPermaLink="false">16798@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thought I should share - here is my code for adding custom taxonomies to forms that create posts.  The taxonomies show up in the form as a set of checkboxes, and the selected terms are saved into the WP post data.  This is nice because it automatically fills in the available taxonomies, and it allows you to select more than one option.&#60;/p&#62;
&#60;p&#62;CODE: &#60;a href=&#34;http://www.pastie.org/1485769&#34; rel=&#34;nofollow&#34;&#62;http://www.pastie.org/1485769&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Things to note:&#60;/p&#62;
&#60;p&#62;Checkboxes in Gravity are a little tricky. In order for this to work, first I created the checkboxes in the form admin, but did not add any options.  You must have the fields be checkboxes though or it won't work.  Also, Gravity saves each checkbox value separately - if your checkbox is field 1, each checked box will be saved separately in the form entry data array as 1.1=&#38;gt; muffin, 1.5=&#38;gt; cookie, etc.  To capture them all I had to use a foreach and substr to get all of the selected values out of the entry data array.&#60;/p&#62;
&#60;p&#62;I had two different taxonomies and two different forms - one using only one tax, one using both of them.  I did this with simple if statements and a switch.  &#60;/p&#62;
&#60;p&#62;Hope this helps somebody!  And if there is a more efficient way to do this, do let me know :)&#60;/p&#62;
&#60;p&#62;Inspiration for this code was found here:&#60;br /&#62;
&#60;a href=&#34;http://forum.gravityhelp.com/topic/automatically-populate-a-dropdown-with-post-titles&#34; rel=&#34;nofollow&#34;&#62;http://forum.gravityhelp.com/topic/automatically-populate-a-dropdown-with-post-titles&#60;/a&#62;&#60;br /&#62;
&#60;a href=&#34;http://forum.gravityhelp.com/topic/custom-taxonomies-for-multiple-forms&#34; rel=&#34;nofollow&#34;&#62;http://forum.gravityhelp.com/topic/custom-taxonomies-for-multiple-forms&#60;/a&#62;
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
