WPML

Overview of the Issue

If you are editing a post via the front-end and that post was duplicated to other languages programmatically, it is possible to receive error like this:

PHP Fatal error:  Uncaught Error: Call to a member function get_translation_job() on null in wp-contentpluginswpml-translation-managementinctranslation-jobshelperswpml-translation-job-helper-with-api.class.php:15

Stack trace:

#0 wp-contentpluginswpml-translation-managementinctranslation-jobshelperswpml-update-post-translation-data-action.class.php(12): WPML_Translation_Job_Helper_With_API->get_translation_job(NULL)

#1 wp-contentpluginswpml-translation-managementinctranslation-jobshelperswpml-update-translation-data-action.class.php(84): WPML_TM_Update_Post_Translation_Data_Action->populate_prev_translation(1020, Array)

#2 wp-contentpluginswpml-translation-managementinctranslation-jobshelperswpml-update-translation-data-action.class.php(33): WPML_TM_Update_Translation_Data_Action->get_translated_field_values(1020, Array)

#3 wp-contentpluginswpml-translation-managementincactionswpml-tm-action-helper.class.p in wp-contentpluginswpml-translation-managementinctranslation-jobshelperswpml-translation-job-helper-with-api.class.php on line 15

Workaround

This issue is fixed in WPML Translation Management 2.10.4. Updating solves it on your site, so you only need this workaround if you can’t update yet.

Make sure that you know what you are doing and that you have created a backup first!

Via FTP client or via your hosting panel, try to edit the file in /wp-content/plugins/wpml-translation-management/inc/translation-jobs/helpers/wpml-translation-job-helper-with-api.class.php
Replace these two rows:

global $wpml_translation_job_factory;

return $wpml_translation_job_factory->get_translation_job( $job_id, $include_non_translatable_elements, $revisions );
with this one row:
return wpml_tm_load_job_factory()->get_translation_job( $job_id, $include_non_translatable_elements, $revisions );

All known issues

Still Seeing This Issue?

If updating doesn’t fix it, ask a support question and we’ll look into it with you.