<?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: Using the Gform predefined choices filter</title>
		<link>https://legacy.forums.gravityhelp.com/topic/using-the-gform-predefined-choices-filter</link>
		<description>Gravity Support Forums Topic: Using the Gform predefined choices filter</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 08:27:31 +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/using-the-gform-predefined-choices-filter" rel="self" type="application/rss+xml" />

		<item>
			<title>Kevin Flahaut on "Using the Gform predefined choices filter"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/using-the-gform-predefined-choices-filter#post-15660</link>
			<pubDate>Fri, 07 Jan 2011 18:38:09 +0000</pubDate>
			<dc:creator>Kevin Flahaut</dc:creator>
			<guid isPermaLink="false">15660@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Our new documentation should be rolling out soon, but for now, here's the details on how to use the Gform predefined choices filter to create new predefined choices for multiple choice fields, checkboxes and drop-down fields.&#60;/p&#62;
&#60;p&#62;Description&#60;br /&#62;
________________________________________&#60;/p&#62;
&#60;p&#62;This filter is executed when the form editor is loaded, before creating the list of predefined choices for the selection fields (Checkboxes, Multiple Choice and Drop Down). This hook can be used to add new predefined choices as well as deleting existing ones.&#60;/p&#62;
&#60;p&#62;Usage&#60;br /&#62;
________________________________________&#60;/p&#62;
&#60;p&#62;Applies to all forms&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
add_filter(&#38;quot;gform_predefined_choices&#38;quot;, &#38;quot;add_predefined_choice&#38;quot;);
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Applies to a specific form. In this case, form Id 5&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
add_filter(&#38;quot;gform_predefined_choices_5&#38;quot;, &#38;quot;add_predefined_choice&#38;quot;);
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Parameters&#60;br /&#62;
________________________________________&#60;/p&#62;
&#60;p&#62;$choices&#60;br /&#62;
(Array) An array with the existing predefined choices to be filtered. It is an associative array where the key is the title and the value is an array containing the choices.&#60;/p&#62;
&#60;p&#62;&#60;code&#62;$choices[&#38;quot;My Favorite Food&#38;quot;] = array(&#38;quot;Fruit&#38;quot;, &#38;quot;Hamburger&#38;quot;, &#38;quot;Beans&#38;quot;);&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Example&#60;br /&#62;
________________________________________&#60;/p&#62;
&#60;p&#62;This example adds a new predefined choice to the end of the list.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php

add_filter(&#38;quot;gform_predefined_choices&#38;quot;, &#38;quot;add_predefined_choice&#38;quot;);
function add_predefined_choice($choices){
   $choices[&#38;quot;My New Choice&#38;quot;] = array(&#38;quot;Choice 1&#38;quot;, &#38;quot;Choice 2&#38;quot;, &#38;quot;Choice 3&#38;quot;);
   return $choices;
}
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Source Code&#60;br /&#62;
________________________________________&#60;/p&#62;
&#60;p&#62;This filter is located in form_detail.php
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
