We detected issue in our backend with some template regarding WPML.
Here is the error we are getting:
Got error 'PHP message: PHP Warning: Undefined array key "template_id" in /home/runcloud/webapps/JobSquad/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/class-wpml-elementor-translate-ids.php on line 117PHP message: PHP Warning: Undefined array key "template_id" in /home/runcloud/webapps/JobSquad/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/class-wpml-elementor-translate-ids.php on line 117'
Languages: English (English )German (Deutsch )French (Français )
Timezone: Europe/Zagreb (GMT+02:00)
Hi,
Thank you for contacting WPML support!
Can you please check if this issue appears when:
- only WPML plugins (along with Elementor as I suppose this is related to Elementor) are activated, as it will tell us if there is an interaction issue with other plugin
- theme is set to a WordPress default like Twenty Twenty as it will tell us if there is an interaction issue with your theme
Maybe your theme or some other plugin expects a translated template ID somewhere.
If it still appears, can you try this - in sitepress-multilingual-cms\addons\wpml-page-builders\classes\Integrations\Elementor\class-wpml-elementor-translate-ids.php, can you replace:
public function translate_global_widget_ids( $data_array, $post_id ) {
foreach ( $data_array as &$data ) {
if ( isset( $data['elType'] ) && 'widget' === $data['elType'] ) {
if ( 'global' === $data['widgetType'] ) {
$data['templateID'] = $this->translate_id( $data['templateID'] );
} elseif ( 'template' === $data['widgetType'] ) {
if ( isset( $data['settings']['template_id'] ) ) {
$data['settings']['template_id'] = $this->translate_id( $data['settings']['template_id'] );
} else {
// Log the missing ID along with other relevant information
error_log( 'Missing template_id for widget: ' . json_encode( $data ) );
// Optionally, you can set a default value
// $data['settings']['template_id'] = '';
// If you want to log into WordPress system log, you can use the following instead
if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
// Append the message to the WordPress debug log
error_log( 'Missing template_id for widget: ' . json_encode( $data ), 3, WP_CONTENT_DIR . 'https://cdn.wpml.org/debug.log' );
}
}
}
}
$data['elements'] = $this->translate_global_widget_ids( $data['elements'], $post_id );
}
return $data_array;
}
The error messages will be logged into the WordPress system log, which you can access via the debug.log file in the wp-content directory of your WordPress installation.
Regards,
Bruno Kos
The topic ‘[Closed] Warning in "template_id"’ is closed to new replies.
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.