<?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: Populate Dropdown with Parent Taxonomy Only.</title>
		<link>https://legacy.forums.gravityhelp.com/topic/populate-dropdown-with-parent-taxonomy-only</link>
		<description>Gravity Support Forums Topic: Populate Dropdown with Parent Taxonomy Only.</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 21:52:43 +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/populate-dropdown-with-parent-taxonomy-only" rel="self" type="application/rss+xml" />

		<item>
			<title>bradvin on "Populate Dropdown with Parent Taxonomy Only."</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populate-dropdown-with-parent-taxonomy-only#post-56683</link>
			<pubDate>Thu, 26 Apr 2012 15:02:25 +0000</pubDate>
			<dc:creator>bradvin</dc:creator>
			<guid isPermaLink="false">56683@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;This problem is now solved with V4 of the GF+CPT plugin. I have a post outlining these features here : &#60;a href=&#34;http://themergency.com/gravity-forms-custom-post-types-v4-beta-testers-wanted/&#34; rel=&#34;nofollow&#34;&#62;http://themergency.com/gravity-forms-custom-post-types-v4-beta-testers-wanted/&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;It is still in beta and I need some testers to test it out, so please lend a hand&#60;/p&#62;
&#60;p&#62;thanks&#60;br /&#62;
Brad
&#60;/p&#62;</description>
		</item>
		<item>
			<title>cabaj on "Populate Dropdown with Parent Taxonomy Only."</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populate-dropdown-with-parent-taxonomy-only#post-56448</link>
			<pubDate>Tue, 24 Apr 2012 17:54:34 +0000</pubDate>
			<dc:creator>cabaj</dc:creator>
			<guid isPermaLink="false">56448@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Trying to do the same thing as Bowlsy
&#60;/p&#62;</description>
		</item>
		<item>
			<title>acsnaterse on "Populate Dropdown with Parent Taxonomy Only."</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populate-dropdown-with-parent-taxonomy-only#post-50146</link>
			<pubDate>Tue, 21 Feb 2012 18:57:24 +0000</pubDate>
			<dc:creator>acsnaterse</dc:creator>
			<guid isPermaLink="false">50146@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Is is possible that the &#34;isSelected&#34; property doesn't work anymore? I have exactly the same code, it generates my list perfectly, but it doesn't preselect the right option anymore. However when I &#34;dump&#34; the $items array, I see that the value is in there.&#60;/p&#62;
&#60;p&#62;Any ideas?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>cameron.crest on "Populate Dropdown with Parent Taxonomy Only."</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populate-dropdown-with-parent-taxonomy-only#post-43586</link>
			<pubDate>Fri, 09 Dec 2011 19:18:49 +0000</pubDate>
			<dc:creator>cameron.crest</dc:creator>
			<guid isPermaLink="false">43586@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Have a client who needs this exact fuctionality with taxonomies.&#60;/p&#62;
&#60;p&#62;Were you ever actually able to get your code to work?  :)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bowlsy on "Populate Dropdown with Parent Taxonomy Only."</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populate-dropdown-with-parent-taxonomy-only#post-38039</link>
			<pubDate>Sun, 16 Oct 2011 22:37:29 +0000</pubDate>
			<dc:creator>bowlsy</dc:creator>
			<guid isPermaLink="false">38039@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Have a situation where users will need to select A Goods Sub-Type from a Parent Goods Type. Whilst I can use this plugin to display the hierarchy in one dropdown: &#60;a href=&#34;http://wordpress.org/extend/plugins/gravity-forms-custom-post-types/&#34; rel=&#34;nofollow&#34;&#62;http://wordpress.org/extend/plugins/gravity-forms-custom-post-types/&#60;/a&#62; The list of goods sub types listed under goods types is very long and really should be displayed with 2 cascading dropdowns.&#60;br /&#62;
Trying to implement a work around by creating a dropdown that filters just the parent taxonomy terms.  Then when a user has selected a parent, one of several hidden child dropdowns will display allowing selection of the goods subtype.&#60;/p&#62;
&#60;p&#62;Managed to get the following code to return the Child Values of a Taxonomy Term in a dropdown:-&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;//Adds a filter to form id 1. Replace 1 with your actual form id - CHILD TERMS FOR TRUCKS
add_filter( &#38;#39;gform_pre_render_1&#38;#39;, &#38;#39;populate_dropdown&#38;#39; );
function populate_dropdown($form){

    //Grab all Terms Associated with a Specific Taxonomy;
    global $post;
      	$termID = 4;
	$taxonomyName = &#38;quot;goodscategories&#38;quot;;
	$termchildren = get_term_children( $termID, $taxonomyName );
    //Creating drop down item array.
    $items = array();

    //Adding initial blank value.
    $items[] = array(&#38;quot;text&#38;quot; =&#38;gt; &#38;quot;&#38;quot;, &#38;quot;value&#38;quot; =&#38;gt; &#38;quot;&#38;quot;);

    //Adding term names to the items array
    //foreach($terms as $term){
    foreach ($termchildren as $child) {
    $term = get_term_by( &#38;#39;id&#38;#39;, $child, $taxonomyName );
        $is_selected = $term -&#38;gt;name == &#38;quot;testing&#38;quot; ? true : false;
        $items[] = array(&#38;quot;value&#38;quot; =&#38;gt; $term -&#38;gt;name, &#38;quot;text&#38;quot; =&#38;gt; $term -&#38;gt;name, &#38;quot;isSelected&#38;quot;=&#38;gt; $is_selected);
    }

    //Adding items to field id 9. Replace 9 with your actual field id. You can get the field id by looking at the input name in the markup.
    foreach($form[&#38;quot;fields&#38;quot;] as &#38;amp;$field)
        if($field[&#38;quot;id&#38;quot;] == 9){
            $field[&#38;quot;type&#38;quot;] = &#38;quot;select&#38;quot;;
            $field[&#38;quot;choices&#38;quot;] = $items;
        }

    return $form;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Tried this code for parent dropdown, but returns no values in the dropdown:-&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;/Adds a filter to form id 1. Replace 1 with your actual form id - PARENT TERMS ONLY
add_filter( &#38;#39;gform_pre_render_1&#38;#39;, &#38;#39;populate_dropdown_parents&#38;#39; );
function populate_dropdown_parents($form){

    //Grab all Terms Associated with a Specific Taxonomy;
    global $post;
       $terms = get_terms(&#38;quot;goodscategories&#38;quot;, &#38;#39;parent=0&#38;#39;);

    //Creating drop down item array.
    $items = array();

    //Adding initial blank value.
    $items[] = array(&#38;quot;text&#38;quot; =&#38;gt; &#38;quot;&#38;quot;, &#38;quot;value&#38;quot; =&#38;gt; &#38;quot;&#38;quot;);

    //Adding term names to the items array
    foreach($terms as $term){
        $is_selected = $term-&#38;gt;name == &#38;quot;testing&#38;quot; ? true : false;
        $items[] = array(&#38;quot;value&#38;quot; =&#38;gt; $term-&#38;gt;name, &#38;quot;text&#38;quot; =&#38;gt; $term-&#38;gt;name, &#38;quot;isSelected&#38;quot;=&#38;gt; $is_selected);
    }

    //Adding items to field id 10. Replace 10 with your actual field id. You can get the field id by looking at the input name in the markup.
   foreach($form[&#38;quot;fields&#38;quot;] as &#38;amp;$field)
        if($field[&#38;quot;id&#38;quot;] == 10){
            $field[&#38;quot;type&#38;quot;] = &#38;quot;select&#38;quot;;
            $field[&#38;quot;choices&#38;quot;] = $items;
        }

    return $form;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Any help would be greatly welcome.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
