<?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: Adding WPML language to post</title>
		<link>https://legacy.forums.gravityhelp.com/topic/adding-wpml-language-to-post</link>
		<description>Gravity Support Forums Topic: Adding WPML language to post</description>
		<language>en-US</language>
		<pubDate>Sat, 04 Apr 2026 12:39:13 +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/adding-wpml-language-to-post" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "Adding WPML language to post"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/adding-wpml-language-to-post#post-77434</link>
			<pubDate>Wed, 26 Sep 2012 08:24:47 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">77434@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thank you for posting your solution.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>revonorway on "Adding WPML language to post"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/adding-wpml-language-to-post#post-77315</link>
			<pubDate>Tue, 25 Sep 2012 12:18:38 +0000</pubDate>
			<dc:creator>revonorway</dc:creator>
			<guid isPermaLink="false">77315@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Ok, just managed to do this with some copy/pasting and searching different places. Here is for anyone else that would need it:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;//This filter prepopulates gravity forms with current language. Add a text field (can be hidden) and tick the &#38;quot;allow field to be populated dynamically&#38;quot; box. The parameter name is current_language.

add_filter(&#38;#39;gform_field_value_current_language&#38;#39;, create_function(&#38;quot;&#38;quot;, &#38;#39;$value = ICL_LANGUAGE_CODE; return $value;&#38;#39; ));

//Then add that language to the icl_post_language of the post just created. Change the 2 after gform_after_submission_ to whatever form needs this. Change entry[6] to whatever field id you have chosen for the language field.

add_action(&#38;quot;gform_after_submission_2&#38;quot;, &#38;quot;set_post_content&#38;quot;, 10, 2);
function set_post_content($entry, $form){

    //getting post
    $post = get_post($entry[&#38;quot;post_id&#38;quot;]);

    //changing post content
    $_POST[&#38;#39;icl_post_language&#38;#39;]= $entry[6];

    //updating post
    wp_update_post($post);
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Voilà! The code is pretty straightforward.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>revonorway on "Adding WPML language to post"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/adding-wpml-language-to-post#post-76643</link>
			<pubDate>Fri, 21 Sep 2012 04:13:06 +0000</pubDate>
			<dc:creator>revonorway</dc:creator>
			<guid isPermaLink="false">76643@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I need to get the current language, which is stored in the wpml ICL_LANGUAGE_CODE constant, and then to store it in this post parameter:&#60;br /&#62;
&#60;code&#62;$_POST[&#38;#39;icl_post_language&#38;#39;]&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Let's say someone is posting on the french part of the site, the current language would be &#34;fr&#34;, and then I would need to store &#34;fr&#34; in the &#60;code&#62;$_POST[&#38;#39;icl_post_language&#38;#39;]&#60;/code&#62; parameter.&#60;/p&#62;
&#60;p&#62;Doing all this in a hidden field would be great if possible.&#60;/p&#62;
&#60;p&#62;Is that helpful or would you need more info?&#60;/p&#62;
&#60;p&#62;Thanks a lot!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Adding WPML language to post"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/adding-wpml-language-to-post#post-76345</link>
			<pubDate>Wed, 19 Sep 2012 15:29:56 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">76345@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;We can help you with the Gravity Forms end of it, but we need to know what WPML needs to see, and where, so we now how to help.  What information do you need stored with the post to enable WPML?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>revonorway on "Adding WPML language to post"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/adding-wpml-language-to-post#post-76284</link>
			<pubDate>Wed, 19 Sep 2012 07:09:28 +0000</pubDate>
			<dc:creator>revonorway</dc:creator>
			<guid isPermaLink="false">76284@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hello,&#60;/p&#62;
&#60;p&#62;I would like to get this working... Has anyone ever tried doing this... I have users with different languages submitting posts from the front end, and would like to add the wpml language info to it...&#60;/p&#62;
&#60;p&#62;Thanks for the help!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Adding WPML language to post"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/adding-wpml-language-to-post#post-74159</link>
			<pubDate>Thu, 06 Sep 2012 08:13:50 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">74159@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;OK.  If you want to give it a shot again, please let us know.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Lea Cohen on "Adding WPML language to post"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/adding-wpml-language-to-post#post-74132</link>
			<pubDate>Thu, 06 Sep 2012 04:07:28 +0000</pubDate>
			<dc:creator>Lea Cohen</dc:creator>
			<guid isPermaLink="false">74132@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;It didn't work for me, and we ended up not doing it.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Adding WPML language to post"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/adding-wpml-language-to-post#post-43722</link>
			<pubDate>Mon, 12 Dec 2011 01:06:45 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">43722@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I believe you can add it using the &#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_post_submission&#34; rel=&#34;nofollow&#34;&#62;gform_post_submission&#60;/a&#62; hook.  However, if you are using Gravity Forms 1.6 or later, that hook has been replaced by &#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_after_submission&#34; rel=&#34;nofollow&#34;&#62;gform_after_submission&#60;/a&#62; and you should now use that instead.&#60;/p&#62;
&#60;p&#62;Please post the whole function you are using with gform_post_submission and maybe we can see what's going on.  It should work fine there.&#60;/p&#62;
&#60;p&#62;&#60;strong&#62;Update:&#60;/strong&#62;&#60;br /&#62;
It's also possible to use the &#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_update_meta&#34; rel=&#34;nofollow&#34;&#62;gform_update_meta&#60;/a&#62; function hooked to gform_after_submission.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Lea Cohen on "Adding WPML language to post"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/adding-wpml-language-to-post#post-43693</link>
			<pubDate>Sun, 11 Dec 2011 06:29:35 +0000</pubDate>
			<dc:creator>Lea Cohen</dc:creator>
			<guid isPermaLink="false">43693@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thank you, Carl.&#60;/p&#62;
&#60;p&#62;I asked them, and they pointed me to a page that lists the &#60;a href=&#34;http://wpml.org/documentation/support/wpml-tables/&#34; rel=&#34;nofollow&#34;&#62;WPML tables&#60;/a&#62;.&#60;br /&#62;
Then I continued to search on how to insert into those tables, and found &#60;a href=&#34;http://forum.wpml.org/topic.php?id=3579&#34; rel=&#34;nofollow&#34;&#62;this post&#60;/a&#62;, which essentially says that this post parameter has to be filled&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;$_POST[&#38;#39;icl_post_language&#38;#39;]&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;And then call &#60;code&#62;wp_insert_post($new_post);&#60;/code&#62;&#60;br /&#62;
Can you guide me how to go on from here?&#60;/p&#62;
&#60;p&#62;I already use the gform_post_submission hook in order to add a custom field to the post, and I call wp_update_post at the end of my function, so I thought I'd add that line right before the call to wp_update_post. But I must be doing it wrong, as the language isn't added. Maybe it's too late to add it there? Maybe an UPDATE to that table is due at that stage?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "Adding WPML language to post"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/adding-wpml-language-to-post#post-43331</link>
			<pubDate>Wed, 07 Dec 2011 13:34:54 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">43331@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I'm not familiar enough with WPML to know how it says what language the post is.  There isn't a built in feature in Gravity Forms for you to select the language because it's not core WordPress functionality so it's not something built into the Post Fields.&#60;/p&#62;
&#60;p&#62;If WPML simply stores the language type as a custom field in post meta for that post then it will be as simple as using the Post Custom Field, set the correct custom field name and then configure it as a drop down and set the choices so they use values that are WPML friendly.&#60;/p&#62;
&#60;p&#62;You'll need to find out from WPML where and how this data is stored.  If it's as post meta, whats the custom field name/key and what is the value that is stored.  Is it's the language code, name, what exactly. You'll need those details to be able to implement this.&#60;/p&#62;
&#60;p&#62;If you can find out from WPML how the language is associated with the post, we can give you some guidance on how to accomplish this using Gravity Forms.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
