[Resolved] Theme settings not working after WPML update
This thread is resolved. Here is a description of the problem and solution.
Problem: The client is experiencing issues where the Theme Settings display data for all languages on the same page instead of just the current language after updating WPML plugins. Additionally, there is an error in ACF PRO: Uncaught TypeError: Illegal offset type in isset or empty. Solution: We recommend deleting all field groups from the German and Italian versions completely, including removing them from the trash. Then, access your settings page and set the following options to "Not translatable": - Options Pages (acf-ui-options-page) - Field Groups (acf-field-group) This ensures that only one version of each field group exists. If the fields are still missing, you may need to manually recreate and translate them, or consider restoring the website to a previous state before these changes were made for further review.
If this solution does not resolve your issue or seems outdated, 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 problems persist, please open a new support ticket.
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.
Background of the issue:
I am trying to have the Theme Settings display data correctly for each language after updating WPML plugins. I encountered an issue where the Theme Settings show data for all languages on the same page instead of just the current language. Additionally, when I update theme settings, I get an error in ACF PRO: Uncaught TypeError: Illegal offset type in isset or empty in public_html/wp-content/plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-flexible-content.php:783. Please let's have a conversation with anydesk.
Symptoms:
Theme Settings display data for all languages on the same page instead of just the current language. Error in ACF PRO: Uncaught TypeError: Illegal offset type in isset or empty in public_html/wp-content/plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-flexible-content.php:783.
Questions:
Why are the Theme Settings displaying data for all languages on the same page?
How can I fix the error in ACF PRO after updating WPML?
Languages: English (English )German (Deutsch )French (Français )
Timezone: Europe/Zagreb (GMT+02:00)
Please make sure to delete all field groups from the German and Italian versions completely. Simply disabling them won’t be enough—please remove them from the trash as well.
Once they are deleted, go to: hidden link
Then, set the following options:
- Options Pages (acf-ui-options-page)
- Field Groups (acf-field-group)
Set both to "Not translatable," as we should have only one version of each field group.
Regarding the missing data, I see that these fields are now empty. Unfortunately, due to improper translation settings for both the field groups and theme options, I can't determine when they were deleted.
At this point, the only options are to manually re-create and translate them, or if possible, restore the website to a previous state before these changes were made. This would allow us to review the setup and update our plugins in a testing environment.
I've managed to save theme settings in secondary language eventually.
But still, when I'm looking at theme settings in secondary language I see values of default language (in the site pages I see correct values), and then if I save it the default language values will be saved! what can I do?
Another thing: when duplicating a post to another language I want the permalink to be like the default language. I added logic in save_post to make the url use only the beginning of the title, until the first space. In default language it's like that, but when duplicating - it creates the link out of the whole title. how can I make it use the same permalink like the default language?
Languages: English (English )German (Deutsch )French (Français )
Timezone: Europe/Zagreb (GMT+02:00)
Can you show me an example of this?
But still, when I'm looking at theme settings in secondary language I see values of default language (in the site pages I see correct values), and then if I save it the default language values will be saved! what can I do?
function custom_wpml_set_duplicate_permalink($post_id) {
// Ensure we're not in an autosave routine
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
// Check if this is a WPML duplicate
$is_duplicate = get_post_meta($post_id, '_wpml_duplicate', true);
if (!$is_duplicate) {
return;
}
// Get the original post ID
$original_post_id = apply_filters('wpml_object_id', $post_id, get_post_type($post_id), false, wpml_get_default_language());
if (!$original_post_id) {
return;
}
// Get the original post's slug
$original_post = get_post($original_post_id);
$original_slug = $original_post->post_name;
if ($original_slug) {
// Update the duplicated post's slug to match the original
remove_action('save_post', 'custom_wpml_set_duplicate_permalink'); // Prevent infinite loop
wp_update_post([
'ID' => $post_id,
'post_name' => $original_slug
]);
add_action('save_post', 'custom_wpml_set_duplicate_permalink'); // Re-add after update
}
}
add_action('save_post', 'custom_wpml_set_duplicate_permalink');
I haven't tested this though and if the above does not work, we can cover it (for our support rules) in another ticket.
In the image I attached you can see theme settings in Italian, but the values are of the default language (english). If I change a value to italian and update I still see the english value. when I look at the db I see that the italian value exists, but after saving all the other fields got the defult english value back.
I also attached part of the wpml settings where you can see options pages are set to Translatable.
I'll try your solution for the second issue and update here...
about the second issue - I've already tried that, and now tried again. The post_name updates, but the permalink, the url of the product, stays the same, and not getting the english one. I also tried adding flush_rewrite_rules();, but it didn't help.
any ideas?
New threads created by Bruno Kos and linked to this one are listed below:
The theme setting not being translated is solved.
I changed it from "same fields for all language" to "expert" and set groups containing text fields to "copy once". This way I could really translate them.
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.