I am developing a plugin extension for WPML to streamline translation creation from a single interface. However, I’ve encountered an issue: when updating post statuses in a loop, everything works fine for the original post, but when I attempt to update a translation (not the original), the translation gets deleted after the second iteration of the loop.
error_log("TRID is missing for element ID: $updated_post_id");
}
}
return null;
}
On the first iteration, the translation updates correctly. However, on the next loop iteration, the translation is deleted, and I cannot figure out why this happens. I’ve added error logs for debugging, but they don’t provide a clear explanation.
Could you help clarify why the translation might be deleted during updates using wp_update_post and do_action('wpml_set_element_language_details')? Perhaps I am missing an essential step in working with the WPML API.
Thank you in advance for your assistance!
Symptoms:
On the first iteration, the translation updates correctly. However, on the next loop iteration, the translation is deleted. Error logs do not provide a clear explanation.
Questions:
Why might the translation be deleted during updates using wp_update_post and do_action('wpml_set_element_language_details')?
Am I missing an essential step in working with the WPML API?
To help speed up the support process, I've enabled a private message for submitting the debug information for this support ticket. Please follow these initial debugging steps: https://wpml.org/faq/provide-debug-information-faster-support/
In short:
- Go to "WPML > Support > Debug Information" (link)
- Copy the Debug Information from there.
- Find the private field I activated and paste that information.
Please share with us the WordPress debug.log
Access your server via FTP and open wp-config.php (in your WordPress root directory).
Insert those lines just before