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

Last updated by Carlos Rojas 3 months, 1 week ago.

Assigned support staff: Carlos Rojas.

Author Posts
May 26, 2019 at 1:26 am #3890349

Pedro Machado Santa

Hello,

We're having a weird—and annoying—case of certain posts being suddenly duplicated while using the Admin.

We've first noticed when we deployed our site live and right after configuring WPML and all associated settings (for example, configuring meta fields copy/translate policy, among other settings), when we're about to hand off the site to the client, we noticed the first case of having around 20 cloned pages with the same name. We disregarded that as a small 'hiccup' and proceded... until it happened again.

(We were also having some weird issues with ATE, and when loaded the live/production database locally to do some tests, noticed that the translations were then appearing on live/production ATE too, probably because the same key/site ID etc, idk, so Raja helped me out on that here: https://wpml.org/forums/topic/duplicated-posts-and-best-way-to-deal-with-staging-dev-production-environments/ )

Meanwhile, as Raja suggested, we did a complete reset of WPML data... and began to re-configure WPML and related settings (slugs, fields copy/translate policy, etc).

But... even before we could finish the whole configuration, right after we finished setting up copy/translate policy on the meta/ACF fields of a custom post and even before doing ANY sort of translation, as soon as we got back to the pages list, there it was: 20 cloned pages of "Formacao Avancada" (the name of one of our pages). Afterwards we also noticed that another custom post of ours had 2 clones as well, out of nowhere.

WordPress didn't gave any visible error and we didn't found anything significant on our error logs.

We're using mainly WPML with ACF, and, because of the theme, with King Composer and CMB2.

Could you help us with this issue? This is a site for a client and we're worried with this.

Really looking forward for your help.

All the best,

Pedro

May 27, 2019 at 7:42 am #3894147

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hello Pedro,
Thank you for contacting WPML support.

1.- I would like to ask you to follow this steps in order to isolate the cause of the issue:
- Back up your site first before making any change, this is for security reasons.
- Flush any cache memory that might exists.
- Activate the debug mode by following the steps described in this link: https://codex.wordpress.org/Debugging_in_WordPress
- Deactivate all the plugins that are not related to WPML.
- Switch for a moment to a WordPress default theme like Twenty Seventeen.
- If the issue is gone, activate one by one to see with which one there is an interaction issue.

Could you tell me the result of this steps?

2.- Please increase the PHP Memory Limit. Minimum requirements are 128Mb: https://wpml.org/home/minimum-requirements/
You can add this to wp-config.php to increase WP memory:

/** Memory Limit */
define('WP_MEMORY_LIMIT', '128M');
define( 'WP_MAX_MEMORY_LIMIT', '128M' );

- Add it above the line /* That's all, stop editing! Happy blogging. */

Kind regards,
Carlos

May 30, 2019 at 12:41 am #3919237

Pedro Machado Santa

Hi Carlos! Thanks for your message.

I've been meaning to drop here a message on this, because, since then, this exact issue appeared on another one of our sites/clients—yikes!

But, the good news is that we think we've been able to pin point the issue.

So just dropping a quick reply, but will add a more detailed message really soon.

Cheers!

May 30, 2019 at 8:51 am #3921439

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hi there,
I'm glad to hear that you might have found the culprit 🙂

I will be waiting for your message.
Regards,
Carlos

May 30, 2019 at 3:35 pm #3924281

Pedro Machado Santa

Hi Carlos!

So, continuing where I left off on the previous message.

Unfortunately, given our current agenda, it hasn't been possible to go through the thorough debug process you suggested, but, nonetheless we got "interesting" news on this.

If at first we were inclined to think the issue could be laying on the mix of theme (Academix) and plugins (CMB2, King Composer, ACF, etc) we were using on this site (hidden link, SITE 1), we're now sure it isn't because, while we were configuring WPML on another client's website (hidden link SITE2)—a more straightforward one in this case, with basically WP and ACF—the issue happened again! 😱

16 duplicated/cloned pages exactly after the same procedure that seemed to trigger the issue on SITE 1, right after we finished setting up copy/translate policy on the meta/ACF fields of that page.

🤔

So we went through a series of debugging procedures with SITE 2 (as it's simpler than SITE 1):

1. We noticed that we still had 40M of WP_MEMORY_LIMIT. We left it as such and loaded back a database backup of the previous to the WPML configuration, and re-did the configuration, and boom, the issue appeared again at the exactly same place, with the same 16 cloned pages! (replicability)

2. We increased the WP_MEMORY_LIMIT to 256M and reloaded the database backup before WPML config, re-did the config and boom! The issue appeared again, at the same place, 16 cloned pages! (doesn't seem to be memory related) We kept the memory at 256M though.

3. We reloaded the database backup, de-activated the Advanced Custom Fields Multilingual plugin, and re-did the whole process and surprise! the issue didn't happened. (strong hint issue lies in ACFML plugin).

4. We re-did the whole process, but now with live logs (tail -f) to check for errors when we did that step. And the log remained clear… until we've set the copy/translate policy of that page and applied it, the log displayed 16 similar warnings! (the same number of cloned pages we observed):

[28-May-2019 13:50:02 UTC] PHP Warning:  Illegal string offset 'wpml_cf_preferences' in /Users/anafilipa/git/cinema-insuflavel/wp-content/plugins/acfml/classes/class-wpml-acf-field-settings.php on line 82
... (repeated this warning 16 times)

A bunch of insight we've gathered with this:

- The issue is replicable.

- The issue doesn't seems memory related.

- The issue happens with some custom posts/pages that have ACF repeater fields configured on them, and possibly when one goes to copy the repeaters system field (`_repeater_field_name`, etc).

- The number of duplicated pages matches the sum of the number of items in all the repeater fields of that particular page/custom post. (seems to indicate the issue might be on some filter/hook that runs on all repeater items or so.)

- The issue only happens when ACFML is active, which alongside the warning log, makes it a strong case for being a ACFML bug.

- The warning log seems to pinpoint the issue to the line 82 of the file wp-content/plugins/acfml/classes/class-wpml-acf-field-settings.php.

- After the issue appears there are all sorts of issues when trying to translate the original page (not allowing to use ATE, nor the classic translation editor).

Now, we've set up an instance with the database loaded up to the point before the issue being triggered, and we would like to share the credentials with you, and ask you to debug the issue in our instance. Is that possible? Could you activate the option to securely share login details with you in this thread?

The steps to replicate that are:

1. Login with WPML Support account on the provided URL

2. Go to Pages

3. Edit Equipa page

4. Scroll down to Multilingual Content Setup

5. Click Show system fields

6. Change `_team` field setup/policy to Copy

7. Change `_the_field_team` field setup/policy to Copy

8. Click Apply, and right afterwards...

9. Boom! 🐛 16 duplicated/cloned Equipa pages! 👎

Looking forward for your help on this—we would love to move on with translations on these two client sites.

Cheers, and thanks!

Pedro

Maria Adelaide

May 31, 2019 at 8:51 am #3928647

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hi Pedro and Maria Adelaide,
Thank you very much for your feedback.

I consulted one of our specialists about this issue and this seems to be a known issue caused when the ACF fields are added via code, without the key "wpml_cf_preferences"
if you set that key - then the issue is not happening (commented in the code above).

In this case I kindly ask you to follow this steps:
- replace the code in wp-content/plugins/acfml/classes/class-wpml-acf-field-settings.php

wp_update_post( array(
						'ID' => $field_object['ID'],
						'post_content' => maybe_serialize( $field_post_content )
					) );

to

wp_update_post( array(
						'ID' => $field_post['ID'],
						'post_content' => maybe_serialize( $field_post_content )
					) );

Could you tell me if the result of the steps above?

Regards,
Carlos

May 31, 2019 at 4:06 pm #3931923

Pedro Machado Santa

(Please ignore this message.)

June 3, 2019 at 9:06 am #3940593

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hi Pedro and Maria!

Could you confirm that the issue was solved with the solution provided?

Regards,
Carlos

June 5, 2019 at 11:44 pm #3964519

Pedro Machado Santa

Hi Carlos,

Thank you for the reply and the suggested fix.

Ok, you might need to re-assess that known issue, because in both these cases we haven't added ACF fields via code, for sure.

I've proceeded to update the code snippet for the one you provided, and while it fixed the duplicated/cloned pages issue, it lead to the translate/copy policy of those fields to stop being updated.

The steps and results we had were:

1. We added the fix.
2. We replicated the previously sent steps and updated the fields `_team` and `_the_field_team` to "Copy".
3. The Equipa page wasn't duplicated or cloned...
4. But when one reloads the edit of Equipa page, the `_team` and `_the_field_team` fields are still marked as "Do not translate", like step 2 hadn't taken place.

To help with your debugging efforts—and I'll stress our need for you to help properly sort this issue—we've saved diffs of complete DB dumps and WPML settings before/after setting these fields with the fix and without the fix, which I'm sharing below:

SQL Dump Compare (before/after setting, no fix in place): hidden link
Settings Compare (before/after setting, no fix in place): hidden link

SQL Dump Compare (before/after setting, with fix in place): hidden link
Settings Compare (before/after setting, with fix in place): hidden link

SQL Dump Compare (result after setting no fix/with fix): hidden link
Settings Compare (result after setting no fix/with fix): hidden link

Also, we reiterate the availability of an instance that we can share the access for you to debug/test/etc, which is ready to have the issue triggered by following the steps detailed on the previous message.

Thank you for the time, and really looking forward hearing from you.

All the best,

Pedro
Partner at Maria Adelaide
hidden link

June 6, 2019 at 10:47 am #3968313

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hi Pedro,
Thank you very much for your detailed answer.

I would like to request temporary access (wp-admin and FTP) to your test site to take better look at the issue. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Our Debugging Procedures

I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site.

Regards,
Carlos

June 12, 2019 at 7:32 am #4001143

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hi Pedro,
Thank you very much for the information provided.

I tried to access the site but the wp-admin credentials didn't work. Could you double check the credentials and edit your previous private message if necessary?

Regards,
Carlos

June 12, 2019 at 11:34 am #4003567

Pedro Machado Santa

Hi Carlos,

Weird, I managed to login on my end with the credentials.

I've generated a new password nonetheless and updated the previous message. Let me know if you managed to login.

Cheers, have a good day.

June 12, 2019 at 12:44 pm #4004423

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hi Pedro,
Thank you very much for your message.

I tried to log in the site with the new credentials but I'm getting this error (see attached image).

Is there any restriction on the site, like a firewall plugin or similar?

Regards,
Carlos

June 12, 2019 at 1:38 pm #4004817

Pedro Machado Santa

Ha, my bad, sorry! 😀

I had a typo on username, I had "????-suppport" (three p's) when it should be "????-support" (two). My bad!

I've updated credentials on message too. Can you please try again now?

Cheers, thanks.

Pedro

June 13, 2019 at 5:36 am #4009541

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hi Pedro,
Thank you very much! I was able to log in the site this time 🙂

I visited the site and I can see that there are several outdated plugins and the core is also outdated. Could you update these and let me know if the issue persists?

If the issue persists I would like to ask your authorization to make a copy of the site to run some tests in a test environment that allows me to isolate the cause of the issue.

Looking forward to your message.
Regards,
Carlos