Please make sure to update to WPML 4.3.4 before reporting any issue

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

Last updated by Lauren 3 months, 3 weeks ago.

Assigned support staff: Lauren.

Author Posts
July 30, 2019 at 1:17 pm #4307935

alexanderA

OK got it. But what about my new issue. Namely, on both sites (dev and live), if I create a new property, and assign it the agent of 'Craig Beechey,' it appears on the English agents page for Craig Beechey (i.e. hidden link). But it does not appear on the French page for Craig Beechey (hidden link). I was under the impression the fix we implemented would ensure that all new properties would display as expected.

July 30, 2019 at 2:44 pm #4308621

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

This happens after you translate the property to French, is that correct? if you manually edit the French translation, what do you see in the assigned agent drop down?

I thought this had been resolved but if you can confirm the above is happening after translating the property, I'll send this back to our 2nd tier for additional debugging.

July 31, 2019 at 9:53 am #4313391

alexanderA

>> This happens after you translate the property to French, is that correct? if you manually edit the French translation, what do you see in the assigned agent drop down?

So to be clear, on my site I have custom code that does the following. Whenever a new post of type 'property' is created in the default language (English), it is also *duplicated* into French and Chinese. So what I have done is create a new English post, and set the agent to 'Craig Beechey.' After that new post is created, the FR duplicate is automatically generated. If i open that, the 'agent' field is set to 'disable agent.' Maybe something about the duplication process isn't copying this field?

>> I thought this had been resolved but if you can confirm the above is happening after translating the property, I'll send this back to our 2nd tier for additional debugging.

I thought I had confirmed it too. I remember creating a test property on my dev site and confirming that. But the issue is definitely occurring now.

July 31, 2019 at 1:05 pm #4314645

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

Okay, my developers took another look and updated the code snippet. Please go to your theme's functions.php file and replace the code you earlier added with the following:

function translate_agent_id($post_id) {
    $meta_key = 'ale_assigned_agent';

    $agent_id = get_post_meta($post_id, $meta_key, true);

    if ($agent_id)
        update_post_meta($post_id, $meta_key, apply_filters('wpml_object_id', $agent_id, 'agents', true));
}

add_filter( 'save_post', 'translate_agent_id', 9999 );

function translate_duplicated_agent_id( $value_to_filter, $target_language, $meta_data ) {
    if ($meta_data['key'] === 'ale_assigned_agent') {
        return $value_to_filter = apply_filters('wpml_object_id', $value_to_filter, 'agents', true, $target_language);
    }

    return $value_to_filter;
}

add_filter( 'wpml_duplicate_generic_string', 'translate_duplicated_agent_id', 10, 3 );

Then resave translated properties. I tested this on my test site and it is now working. If you create a new property and translate it, it should work fine as well. Please let me know the results.

August 1, 2019 at 6:44 am #4319053

alexanderA

OK thanks for that. I added the code to my dev site, tested it with a new post, and the issue seems to have gone away. Funny thing though, on my live site, since we last spoke, 2 new properties were created. Let me start going through my live site and updating all ~600 posts, to slowly resolve the issue there. Can we keep this ticket open for a week or two while I do that, just in case I run into related issues?

August 1, 2019 at 12:09 pm #4321375

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

Sure, we can keep this open while you continue saving the translations. Let me know if you run into anything.