Skip Navigation

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

Last updated by Carlos Rojas 1 year, 4 months ago.

Assigned support staff: Carlos Rojas.

Author Posts
January 31, 2020 at 12:49 pm #5399135

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Hi Liborio,
I'm sorry for the delay.

Our specialists suspect that the cause of the issue is in the theme, but they are still working on this issue.

Regards,
Carlos

January 31, 2020 at 12:52 pm #5399273

Apulia Vending s.r.l.

Hi Carlos,
you're welcome, I imagine they're quite busy.

I would really appreciate if t they could provide further details asap.

Thanks for your help.

Best regards
Liborio Fedele

January 31, 2020 at 1:04 pm #5399367

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Hi Liborio,

I will ping them to see if they have any news.

Regards,
Carlos

February 1, 2020 at 3:06 pm #5404603

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Hi Liborio,

I have a workaround from our 2nd tier specialists. Please follow this steps:
- Create a full backup of the site
- Edit the functions.php file within the theme's folder and add the following code:

add_action( 'wpml_after_copy_custom_field', function($post_id_from, $post_id_to, $meta_key){
    if ($meta_key == 'shb_pricing') {
        $translated_lang = apply_filters( 'wpml_post_language_details', '', $post_id_to );
        $translated_lang = isset($translated_lang['language_code']) ? $translated_lang['language_code'] : ''; 
        
	$original_value = get_post_meta($post_id_from, 'shb_pricing', true);
	$translated_value = $original_value;
	
	if (!empty($original_value) && is_array($original_value)) {
	    foreach ($original_value as $key => $value) {
		$session_id = intval(substr($key, 7));
		if ( !empty($session_id) ) {
		    $session_id = apply_filters( 'wpml_object_id', $session_id, 'shb_season', false, $translated_lang );
		    $translated_value['season_' . $session_id] = $translated_value[$key];
		    unset($translated_value[$key]);
		}
	    }
	    
	    update_post_meta($post_id_to, 'shb_pricing', $translated_value);
	}
    }
}, 10, 3);

- Save the changes.

Could you tell me if the issue was solved?

Regards,
Carlos

February 2, 2020 at 7:12 pm #5408047
Apulia Vending s.r.l.

Hi Carlos,
thank you so much for the code provided, it fixed the issue related to the room prices' copy. Unfortunately I still can't save the occupancy numbers for the translated rooms.

Could you help, please?

Best regards,
Liborio Fedele

New threads created by Carlos Rojas and linked to this one are listed below:

https://wpml.org/forums/topic/split-deny-custom-field-translation/

February 3, 2020 at 10:33 am #5411179

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Hi Liborio,
I'm glad to hear that the issue is solved 🙂

As the original issue is solved I will split this ticket so we can continue with debugging the new problem related to the occupancy there.

You can set this ticket as solved already.
Best regards,
Carlos