Salta la navigazione

Questo thread è stato risolto. Ecco una descrizione del problema e della soluzione.

Problem:
If you're experiencing a 500 error when trying to copy content into a translation using the 'copy_from_original' AJAX call, it might be due to the function attempting to select distinct from all meta fields in a site with many post meta, which leads to the error.
Solution:
We recommend modifying the code to add a filter by post_id in the function that selects meta fields. This change should help in reducing the load and preventing the 500 error. For detailed steps on how to implement this, please refer to our forum post: https://wpml.org/forums/topic/syncing-custom-fields-performance-issues/#post-15258092.

If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your case, 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. Additionally, you can open a new support ticket for further assistance at WPML support forum.

Questo è il forum di assistenza tecnica di WPML, il plug-in multilingue di WordPress.

La sua lettura è permessa a tutti, ma la pubblicazione è riservata esclusivamente ai clienti di WPML. Il team di WPML risponde sul forum 6 giorni su 7, 22 ore su 24.

Etichettato: 

Questo ticket contiene 2 risposte, ha 2 voci.

Ultimo aggiornamento da Paola Mendiburu 6 mese fa.

Assistito da: Paola Mendiburu.

Autore Messaggi
Luglio 25, 2024 a 10:34 am #16002830

manuelF-6

Contesto del problema:
We are trying to copy content into a translation from it's original content.
The request goes in 500 error so we decided to understand why.
We found that the AJAX call used to copy the content is "copy_from_original".
Inside this call is being called the following functions (in order):
1) WPML_Post_Edit_Ajax::copy_from_original_fields
2) self::copy_meta_values_from_original
3) self::$post_custom_field_settings->get_post_meta_keys() (from WPML_Custom_Field_Setting_Factory)
4) WPML_Custom_Field_Setting_Factory::get_post_meta_keys()
5) $this->tm_instance->initial_custom_field_translate_states()

Inside the function initial_custom_field_translate_states we can see that you SELECT distinct from ALL the meta fields. As a result, in a website with many post meta the request goes in error.

Such we don't need to pull ALL the meta fields here but just the once related to the post, we suggest to improve your code by adding a filter by post_id in that function.

Sintomi:

Domande:

Luglio 25, 2024 a 1:15 pm #16003749

Paola Mendiburu
Supporter

Lingue: Inglese (English ) Spagnolo (Español ) Italiano (Italiano )

Fuso orario: Europe/Madrid (GMT+01:00)

L'ho spostato al secondo livello.

Ti farò sapere appena avrò novità.

Luglio 26, 2024 a 7:44 am #16007207

Paola Mendiburu
Supporter

Lingue: Inglese (English ) Spagnolo (Español ) Italiano (Italiano )

Fuso orario: Europe/Madrid (GMT+01:00)

Ciao!

Per risolvere il problema devi fare questo:
https://wpml.org/forums/topic/syncing-custom-fields-performance-issues/#post-15258092

Dimmi se hai qualche problema.