i’m using Thermal-Api plugin in order to define a REST WS to get posts in JSON format.
My Client uses WPML to translate posts and i need to pass to WP_Query the language set in front-end side.
Is there a particular parameter to pass to WP_Query to select only the post in that language or is there a way to change dynamically “ICL_LANGUAGE_CODE” in order to retrieve what i need??
Thanks!!
Assuming
$new_lang
holds the desired two letter language code (e.g. ‘fr’), you can do this:For more info, check http://wpml.org/documentation/support/achieving-wpml-compatibility-for-your-themes-and-plugins/debugging-theme-compatibility/