<?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: Select dropdown with categories not ordering properly</title>
		<link>https://legacy.forums.gravityhelp.com/topic/select-dropdown-with-categories-not-ordering-properly</link>
		<description>Gravity Support Forums Topic: Select dropdown with categories not ordering properly</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 01:13:44 +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/select-dropdown-with-categories-not-ordering-properly" rel="self" type="application/rss+xml" />

		<item>
			<title>David Peralty on "Select dropdown with categories not ordering properly"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/select-dropdown-with-categories-not-ordering-properly#post-230981</link>
			<pubDate>Tue, 30 Apr 2013 10:29:24 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">230981@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Looks great. All my best!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>fu7u on "Select dropdown with categories not ordering properly"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/select-dropdown-with-categories-not-ordering-properly#post-230782</link>
			<pubDate>Tue, 30 Apr 2013 05:43:50 +0000</pubDate>
			<dc:creator>fu7u</dc:creator>
			<guid isPermaLink="false">230782@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Solved! Here's my solution, please let me know if there's a better way of doing this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;#39;gform_pre_render&#38;#39;, &#38;#39;order_that_stuff&#38;#39;);
function order_that_stuff($form) {

  foreach ($form[&#38;#39;fields&#38;#39;] as $key =&#38;gt; $field) {
    if ($field[&#38;#39;type&#38;#39;] == &#38;#39;post_category&#38;#39; &#38;amp;&#38;amp; $field[&#38;#39;inputType&#38;#39;] == &#38;#39;select&#38;#39;) {

      $sorted_choices = array();

      foreach ($field[&#38;#39;choices&#38;#39;] as $choice) {
        $sorted_choices[] = $choice;
      }

      asort($sorted_choices);
      $form[&#38;#39;fields&#38;#39;][$key][&#38;#39;choices&#38;#39;] = $sorted_choices;

    }
  }

  return $form;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>fu7u on "Select dropdown with categories not ordering properly"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/select-dropdown-with-categories-not-ordering-properly#post-230741</link>
			<pubDate>Tue, 30 Apr 2013 04:51:03 +0000</pubDate>
			<dc:creator>fu7u</dc:creator>
			<guid isPermaLink="false">230741@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;PHP-version: 5.3.6&#60;br /&#62;
MySQL-version: 5.5.9&#60;br /&#62;
Wordpressversion: 3.5.1&#60;br /&#62;
Gravity Forms Version: 1.7.2
&#60;/p&#62;</description>
		</item>
		<item>
			<title>fu7u on "Select dropdown with categories not ordering properly"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/select-dropdown-with-categories-not-ordering-properly#post-230737</link>
			<pubDate>Tue, 30 Apr 2013 04:37:07 +0000</pubDate>
			<dc:creator>fu7u</dc:creator>
			<guid isPermaLink="false">230737@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I've written this filter that sorts all my categories in the dropdown but still the same problem, anyone?&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;#39;gform_pre_render_2&#38;#39;, &#38;#39;order_that_stuff&#38;#39;);
function order_that_stuff($form) {

  foreach ($form[&#38;#39;fields&#38;#39;] as $field) {
    if ($field[&#38;#39;type&#38;#39;] == &#38;#39;post_category&#38;#39; &#38;amp;&#38;amp; $field[&#38;#39;inputType&#38;#39;] == &#38;#39;select&#38;#39;) {

      $sorted_choices = array();

      foreach ($field[&#38;#39;choices&#38;#39;] as $choice) {
        $sorted_choices[] = $choice;
      }

      asort($sorted_choices);
      $field[&#38;#39;choices&#38;#39;] = $sorted_choices;

      echo &#38;#39;&#38;lt;pre&#38;gt;&#38;#39;;
      print_r($field);
      echo &#38;#39;&#38;lt;/pre&#38;gt;&#38;#39;;
    }
  }

  return $form;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>fu7u on "Select dropdown with categories not ordering properly"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/select-dropdown-with-categories-not-ordering-properly#post-229969</link>
			<pubDate>Mon, 29 Apr 2013 13:56:17 +0000</pubDate>
			<dc:creator>fu7u</dc:creator>
			<guid isPermaLink="false">229969@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I checked my wp_term_taxonomy table and added up the amount of categories where post count is grater than 0, the result is also 21. So my guess is that categories with posts are being pushed up to the top of the list.&#60;/p&#62;
&#60;p&#62;Is there a way to make sure the dropdown always list categories in alphabetical order?&#60;/p&#62;
&#60;p&#62;Thanks.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>fu7u on "Select dropdown with categories not ordering properly"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/select-dropdown-with-categories-not-ordering-properly#post-229828</link>
			<pubDate>Mon, 29 Apr 2013 11:42:32 +0000</pubDate>
			<dc:creator>fu7u</dc:creator>
			<guid isPermaLink="false">229828@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;I have about 200 categories which are all of the municipalities in Sweden. Of some reason not all of my categories are ordered alphabetically. The first 21 items in the list are just random ones, and then the rest is ordered as they should. They are all child categories of a category called &#34;Municipality&#34;.&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://i44.tinypic.com/4qq89l.png&#34; rel=&#34;nofollow&#34;&#62;http://i44.tinypic.com/4qq89l.png&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;I've tried running it on TwentyTwelve with all plugins deactivated, same result.&#60;/p&#62;
&#60;p&#62;Thanks.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
