Skip Navigation

Resolved

Overview of the issue

If you have a Shortcode widget with some content in Elementor and translate the page using WPML’s translation editor, the Shortcode content will not be available for translation.

Workaround

We’re working on a fix for this issue. In the meantime you can fix it by adding this snippet of code to your theme functions.php file.

add_action('init', function (){
add_filter( 'wpml_elementor_widgets_to_translate', 'shortcode_widget_registration' );
});
 
/**
* Translate Shortcodes widget by elementor
* @param array $widgets
* @return array
*/
function shortcode_widget_registration($widgets) {
$widgets['shortcode'] = [
'conditions' => ['widgetType' => 'shortcode'],
'fields' => [
[
'field' => 'shortcode',
'type' => __('Enter your shortcode', 'sitepress'),
'editor_type' => 'AREA'
],
 
],
];
 
return $widgets;
}

Once you have done that, edit the page in the original language and then update the translation and you’ll find the Shortcode widget content available for translation.

2 Réponses à “Elementor Shortcode Widget is not Translated”

  1. Hi, I inserted the code in the function.php file, edited the page and then updated the translation, now the shortcode string appears in the translations page, but even if modified, the shortcode continues to work without any changes present on the main page. My shortcode is a booking bar which, after selecting the dates, redirects you to a link. While changing the destination link in the translation editor, the shortcode continues to send to the link on the untranslated page.