Problem: You are trying to display a translated global form using WPML on your Elementor site, but the form appears in the original English instead of the expected translation. Solution: This issue has been reported to Elementor and will be fixed in a future update of the plugin. In the meantime, we recommend adding the following code to your theme's functions.php file to ensure the Elementor global form is translated correctly. Please ensure you have a full backup of your site before proceeding.
// === WPML not translating contact forms FIX ===
if ( ! is_admin() ) {
add_filter( 'get_post_metadata', 'wpmlpb_735_translate_elementor_data', 10, 4 );
}
function wpmlpb_735_translate_elementor_data( $value, $object_id, $meta_key, $single ) {
// Only act on Elementor data
if ( '_elementor_data' !== $meta_key ) {
return $value;
}
// Temporarily remove this filter to avoid infinite recursion
remove_filter( 'get_post_metadata', 'wpmlpb_735_translate_elementor_data', 10 );
// Get the actual Elementor data
$elementor_data = get_post_meta( $object_id, '_elementor_data', $single );
// Re-add the filter
add_filter( 'get_post_metadata', 'wpmlpb_735_translate_elementor_data', 10, 4 );
// Process and convert dynamic elements if possible
if ( is_string( $elementor_data ) && ! empty( $elementor_data ) ) {
$data_array = json_decode( $elementor_data, true );
if ( is_array( $data_array ) && class_exists( '\WPML\PB\Elementor\Hooks\DynamicElements' ) ) {
$dynamic_elements = new \WPML\PB\Elementor\Hooks\DynamicElements();
$data_array = $dynamic_elements->convert( $data_array );
return json_encode( $data_array );
}
}
return $elementor_data;
}
Test this solution on a staging site first. If you encounter any issues or need further assistance, please do not hesitate to contact us. Additionally, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If this solution does not apply or is outdated, please open a new support ticket.