This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
This topic contains 3 replies, has 2 voices.
Last updated by Yvette 2 years, 7 months ago.
Assisted by: Yvette.
Author | Posts |
---|---|
May 23, 2022 at 3:54 am #11275823 | |
omerP |
How can we programmatically create a post only in a secondary language ? |
May 23, 2022 at 10:51 am #11279129 | |
Yvette Supporter
Languages: English (English ) Spanish (Español ) Timezone: Europe/Paris (GMT+01:00) |
Hmmm. I am not sure that we support that scenario. However, you could create the post normally then use the following hooks to update the just-created post with language details you prefer: wpml_element_trid() More here: Note. There may be other hooks that you may need to use. I am not a developer but I can orient you towards a solution. If you need more detailed help, I will need to refer you to a WPML Contractor. |
May 25, 2022 at 3:38 am #11298909 | |
omerP |
I used code from your suggested link ( https://wpml.org/wpml-hook/wpml_set_element_language_details/ ) But posts are added only in one language. Would you please guide us that what is wrong in that? |
May 25, 2022 at 11:25 am #11303893 | |
Yvette Supporter
Languages: English (English ) Spanish (Español ) Timezone: Europe/Paris (GMT+01:00) |
In your original post, you said you only wanted to add the post in the secondary language. I am a bit confused on your question. The thought is that you would do the following: 1. Add a post normally in whatever way you do that. As I said, I am not a programmer - I can only give you an idea on how to proceed and to guide you through available hooks/filters. |