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

Last updated by Ayelet Oz 6 hours, 42 minutes ago.

Assisted by: Bruno Kos.

Author Posts
February 19, 2025 at 12:41 pm

Ayelet Oz

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?

February 19, 2025 at 2:47 pm
February 19, 2025 at 2:56 pm #16725449

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01: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.

all empty.png
February 19, 2025 at 8:39 pm #16726757

Ayelet Oz

I did what you said, but I still get the same error when updating italian theme settings. how can I delete it and recreate it?

February 20, 2025 at 9:03 am #16728291

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

I get "Error: The username support is not registered on this site" again.

Can you recreate this user?

February 24, 2025 at 12:23 pm #16740894

Ayelet Oz

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?

February 24, 2025 at 2:56 pm #16741715

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01: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?

Screenshots would help.

For the second question, did you consider something like this:
https://wpml.org/wpml-hook/wpml_admin_make_post_duplicates/

so e.g.

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.

February 24, 2025 at 6:19 pm #16742637

Ayelet Oz

thanks.
about the first issue:

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...

Screenshot 2025-02-24 201724.png
Screenshot 2025-02-24 201058.png
February 24, 2025 at 7:23 pm #16742903
Ayelet Oz

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:

https://wpml.org/forums/topic/split-theme-settings-not-working-after-wpml-update/

February 25, 2025 at 8:58 am #16744399

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

I get "Error: The username support is not registered on this site" again.

Can you recreate this user?

February 25, 2025 at 9:52 am
February 25, 2025 at 12:27 pm #16745616

Ayelet Oz

Did you log in?

February 25, 2025 at 4:20 pm #16746946

Ayelet Oz

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.

I still have another unsolved issue - the permalink of a translated post, here: https://wpml.org/forums/topic/split-theme-settings-not-working-after-wpml-update/