We have just released WPML 4.3.3. Before reporting issues please make sure to update - this version resolves all known issues with the major WPML 4.3 release

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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 5 replies, has 2 voices.

Last updated by Victor Santacreu 3 weeks, 5 days ago.

Assigned support staff: Bruno Kos.

Author Posts
September 18, 2019 at 11:35 am #4595853

Victor Santacreu

I'm developing a large site with a lot of content. The site have 6 languages. The site have a people profiles created as a custom type and a copywriter of the company make all the translations for de around 800 profiles.

But someone now just think that we could add data from profile to the postmeta to do some accurate search. I was imported all data to the postmeta of English Translation (master language) and now i need a process to insert data into translations. But I don't know how to do this process.

I just reading WPML documentation about Hooks but i don't figure out how add data to translations.

I was wrote code to do that: (this code was inside plugin):

// we get all profiles from database
$query = new WP_Query( array(
        'post_type' => 'portfolio', 
        'post_status' => 'publish',
        'nopaging' => true,

    ) );

    $posts = $query->posts;

    global $sitepress;

    foreach ($posts as $p) {

        $raw = get_post_meta($p->ID, '_OldData', true ); // load data we need

        $trid = $sitepress->get_element_trid($p->ID, 'post_' . $p->post_type); // get trid
        $translations = $sitepress->get_element_translations($trid, 'post_' . $p->post_type); // get translations

        if ($raw) {
            $data = json_decode($raw, TRUE);

            // update English
            update_post_meta($p->ID, 'ebavs_name', $data['first_name']);
            update_post_meta($p->ID, 'ebavs_lastname', $data['last_name']);
            update_post_meta($p->ID, 'ebavs_city', $data['location']);
            update_post_meta($p->ID, 'ebavs_nationality', $data['nationality']);

            foreach ($translations as $lang => $tpost) {
                  if ($data['title-' . $lang] !== '') {
                          // Here need insert data in translated string post


The code is working fine. Only I need te create the translation.

Thank You

September 19, 2019 at 10:44 am #4603747

Bruno Kos

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)


Thank you for contacting WPML support!

I don't think it is possible - and even if it is, it may require custom work and testing from our contractors (https://wpml.org/contractors/), because I see no hooks that are responsible for inserting the content - translations to be specific:

I also wasn't able to find any working example in our archives, that could potentially help you with this.

Bruno Kos

September 19, 2019 at 4:02 pm #4607093

Victor Santacreu

Hi, I'm a web developer with more than 10 years working with wordpress. I don't need a contractor, worse things I have faced.

I was read the link before you post here. For me the problem is that documentation is oriented to allow developers to make and register fields and duplicate posts to allow translators to fill later. I was did this step. I have registered fields and i was developed metabox to allow translators and copywriters to fill it in posts. But isn't the problem, the problem is to fill with data via php.

Inside Documentation not exist any function or action or filter that allow me to save a translation value. Is the reason i'm asking here.

I need something like:

wpml_save_translation_value_postmeta($trid || $post_id, $lang, $field, $value);


September 20, 2019 at 6:22 am #4609951

Bruno Kos

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)


If there was a hook of this kind in our API, then we would already find it :). However I don't see anything and that documentation contains all the hooks implemented into WPML.

I'm not sure where something like this brings anything to this discussion:

Also, maybe this would be useful in your scenario:

"Apart from its straightforward implied usage, the hook can prove to be useful when one needs to connect two elements with one as the “Translation of” the other. Refer to the “Hook Example Usage” section below for an example of this."

So perhaps using your code to create another set of fields and then use the above hook to connect original and translation.

Bruno Kos

September 20, 2019 at 8:36 am #4610641

Bruno Kos

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)


I got some confirmation from our 2nd tier support about what I suggested in my reply above, that being:

"Actually, WPML just holds the relationship, not the actual content. So you need to insert the content using WP methods and then connect them using this hook https://wpml.org/wpml-hook/wpml_set_element_language_details/"

Bruno Kos

October 18, 2019 at 8:21 am #4779317

Victor Santacreu


sorry for long days without a response. I was resolved on my own.
The links provided by support staff NOT resolve the problem i was asked originally.

I was resolved deeply hard in code and finally writing a complex php solution in my functions.php.

If anyone needs a solution about this, contact me directly.