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.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 - -
- - - - - - -

Supporter timezone: Africa/Cairo (GMT+03:00)

Tagged: 

This topic contains 0 reply, has 0 voices.

Last updated by Osama Mersal 3 months, 2 weeks ago.

Assisted by: Osama Mersal.

Author Posts
February 27, 2025 at 9:22 am #16754703

esmeraldaC

Background of the issue:
I am trying to manage translations for my site, which is in English, using Elementor. I duplicate posts under the 'Excursions' post type into French, set the translation method to WordPress Editor, and choose to translate posts independently. I modify and publish the French version successfully.

Symptoms:
When I edit the original English post content via Elementor or the WordPress editor, the translated French content gets overwritten with the English content. This issue occurs even if I only change the title or other fields. The problem happens with all posts and is repetitive.

Questions:
Why does editing the original English post overwrite the translated French content?
How can I prevent the translated content from being overwritten when I edit the original post?

February 27, 2025 at 2:25 pm #16756661

esmeraldaC

I tested as you suggested:
1. Create a new post in the default language.
2. Copy the content from default language problematic post and paste in new post.
3. Then, try the same procedure with secondary language post and see if it works correctly with new posts.

The result is the same as it was with the problematic post before - the content will be overwritten with english one as I described.

Regards!

February 27, 2025 at 3:47 pm #16757042

esmeraldaC

Here is one error log which appeared probably during that time when the translation problems occurred with the post:

[27-Feb-2025 15:36:07 UTC] WordPress database error Duplicate entry '136298-1226' for key 'PRIMARY' for query INSERT INTO `wp_icl_links_post_to_post` (`id_from`, `id_to`) VALUES (136298, 1226) made by shutdown_action_hook, do_action('shutdown'), WP_Hook->do_action, WP_Hook->apply_filters, WPML\UserInterface\Web\Infrastructure\WordPress\CompositionRoot\Config\Event\Translation\Links\ItemUpdateEvent->WPML\UserInterface\Web\Infrastructure\WordPress\CompositionRoot\Config\Event\Translation\Links\{closure}, WPML\Infrastructure\WordPress\Component\Translation\Application\Event\Links\ItemUpdateEventListenerAdapter->onShutdown, WPML\Core\Component\Translation\Application\Event\Links\ItemUpdateListener->onItemSave, WPML\Core\Component\Translation\Domain\Links\HandleUpdateOriginal->handle, WPML\Core\Component\Translation\Domain\Links\HandleUpdateOriginal->collectRelationships, WPML\Infrastructure\WordPress\Component\Translation\Domain\Links\Repository->addRelationship

March 2, 2025 at 12:50 pm #16765500

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Thanks for contacting WPML forums support. I'll be glad to help you today.

First of all, sorry for the late reply; it was due to a higher workload.

I would need to look closely at your site, so I would need to request temporary access (WP-Admin and FTP)
Preferably to a test site where the problem has been replicated.

Your answer will be private, meaning only you and I can access it.

❌ Please back up your database and website ❌

✙ I need your permission to deactivate and reactivate the plugins and themes and change site configurations. This is also why the backup is critical.

✙ I also need your permission to take a local copy of your site to debug the issue without affecting your live site.

Best regards,
Osama

March 3, 2025 at 9:40 am #16767659

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Thanks for the access details. I've consulted our second-tier support team about this issue and will update you as soon as they reply.

Best regards,
Osama

March 5, 2025 at 1:14 pm #16778825

esmeraldaC

Hi
Any updates?

Regards!

March 5, 2025 at 4:12 pm #16779822

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

The issue is in our second-tier support team's queue now, and I'll update you as soon as I have more information.

Thanks for your patience

Best regards,
Osama

March 6, 2025 at 1:51 am #16780915

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Please add the following code to your theme's function.php file.

/**
 * Workaround for wpmlsupp-12507
 */
add_action( 'shutdown', function() {

    if ( isset($_POST['action']) && $_POST['action'] == "elementor_ajax" 
        &&
        ! empty( $_POST['actions'] ) && strpos( $_POST['actions'], 'save_builder' ) !== false
    ) {

        global $wp_filter;
        
        $hook_name  = 'shutdown';
        $priority   = 20;
        $class_name = 'WPML_PB_Integration';
        $method     = 'save_translations_to_post';
        
        // Make sure this hook is defined and is a WP_Hook object
        if ( isset( $wp_filter[ $hook_name ] ) && is_a( $wp_filter[ $hook_name ], 'WP_Hook' ) ) {
            $hook = $wp_filter[ $hook_name ];
            
            // Check that priority exists in the callbacks array
            if ( isset( $hook->callbacks[ $priority ] ) ) {
                // Loop through each callback at that priority
                foreach ( $hook->callbacks[ $priority ] as $unique_id => $callback_data ) {
                    // Each callback's function is stored in $callback_data['function']
                    $callback = $callback_data['function'] ?? null;
                    
                    if ( is_array( $callback ) ) {
                        [$object_or_class, $callback_method] = $callback;
                        
                        // Match both the method name and the class
                        if ( $callback_method === $method
                        && is_object( $object_or_class )
                        && get_class( $object_or_class ) === $class_name
                        ) {
                            // Remove it!
                            unset( $hook->callbacks[ $priority ][ $unique_id ] );
                        }
                    }
                }
            }
        }
    }
}, 1 );

After that, please try to reproduce the issue and let me know if the issue is fixed.

Best regards,
Osama

March 6, 2025 at 9:16 am #16781943

esmeraldaC

Hi

I still have the same issues with the "old" posts which I created a couple of days ago - should it fix the problem for all the posts afterwards or should I create new posts and check then?

Regards!

March 6, 2025 at 9:18 am #16781974

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Could you please check with new posts and let me know if they work correctly?

Best regards,
Osama

March 7, 2025 at 2:22 pm #16788967

esmeraldaC

Hi

As it seems it's not fully working since there are still some issues with the translations (content gets overwritten with the main language).
Another fatal error message occurs while editing those problematic posts:

[07-Mar-2025 14:17:29 UTC] PHP Fatal error: Uncaught TypeError: WPML\StringTranslation\Infrastructure\StringGettext\Repository\FrontendQueueJsonRepository::get(): Return value must be of type array, null returned in /home/mrgkmaqj/quetzal/wp-content/plugins/wpml-string-translation/StringTranslation/Infrastructure/StringGettext/Repository/FrontendQueueJsonRepository.php:36
Stack trace:
#0 /home/mrgkmaqj/quetzal/wp-content/plugins/wpml-string-translation/StringTranslation/Infrastructure/StringGettext/Repository/FrontendQueueRepository.php(51): WPML\StringTranslation\Infrastructure\StringGettext\Repository\FrontendQueueJsonRepository->get()
#1 /home/mrgkmaqj/quetzal/wp-content/plugins/wpml-string-translation/StringTranslation/Infrastructure/StringHtml/Command/QueueGettextStringsToBeSetAsFrontendCommand.php(48): WPML\StringTranslation\Infrastructure\StringGettext\Repository\FrontendQueueRepository->save()
#2 /home/mrgkmaqj/quetzal/wp-content/plugins/wpml-string-translation/StringTranslation/Application/StringHtml/Service/HtmlStringsService.php(81): WPML\StringTranslation\Infrastructure\StringHtml\Command\QueueGettextStringsToBeSetAsFrontendCommand->run()
#3 /home/mrgkmaqj/quetzal/wp-content/plugins/wpml-string-translation/StringTranslation/Application/StringHtml/Service/HtmlStringsService.php(69): WPML\StringTranslation\Application\StringHtml\Service\HtmlStringsService->queueGettextStringsEqualToHtmlStringsAsFrontend()
#4 [internal function]: WPML\StringTranslation\Application\StringHtml\Service\HtmlStringsService->readHtmlFromBuffer()
#5 /home/mrgkmaqj/quetzal/wp-includes/functions.php(5464): ob_end_flush()
#6 /home/mrgkmaqj/quetzal/wp-includes/class-wp-hook.php(324): wp_ob_end_flush_all()
#7 /home/mrgkmaqj/quetzal/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#8 /home/mrgkmaqj/quetzal/wp-includes/plugin.php(517): WP_Hook->do_action()
#9 /home/mrgkmaqj/quetzal/wp-includes/load.php(1279): do_action()
#10 [internal function]: shutdown_action_hook()
#11 {main}
thrown in /home/mrgkmaqj/quetzal/wp-content/plugins/wpml-string-translation/StringTranslation/Infrastructure/StringGettext/Repository/FrontendQueueJsonRepository.php on line 36

March 8, 2025 at 12:17 am #16790578

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Please check this page and apply the workaround mentioned there.

Best regards,
Osama

March 14, 2025 at 12:00 pm #16816503

esmeraldaC

Hi
Based on my tests the problem still exists - the content is overwritten with the original language within elementor as I described before and showed in my videos.
Any help?

Regards!

March 14, 2025 at 10:44 pm #16818786

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

I'll check with our 2nd tier support team.

Thanks,
Osama

March 24, 2025 at 5:18 pm #16853559

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Would you please check the provided access details?

Best regards,
Osama

The topic ‘[Closed] Translated pages content get overwritten by main language’ is closed to new replies.