Skip Navigation

Resolved

Reported for: WPML Translation Management 2.10.3

Resolved in: WPML Translation Management 2.10.4

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-content\plugins\wpml-translation-management\inc\translation-jobs\helpers\wpml-translation-job-helper-with-api.class.php:15
Stack trace:
#0 \wp-content\plugins\wpml-translation-management\inc\translation-jobs\helpers\wpml-update-post-translation-data-action.class.php(12): WPML_Translation_Job_Helper_With_API->get_translation_job(NULL)
#1 \wp-content\plugins\wpml-translation-management\inc\translation-jobs\helpers\wpml-update-translation-data-action.class.php(84): WPML_TM_Update_Post_Translation_Data_Action->populate_prev_translation(1020, Array)
#2 \wp-content\plugins\wpml-translation-management\inc\translation-jobs\helpers\wpml-update-translation-data-action.class.php(33): WPML_TM_Update_Translation_Data_Action->get_translated_field_values(1020, Array)
#3 \wp-content\plugins\wpml-translation-management\inc\actions\wpml-tm-action-helper.class.p in \wp-content\plugins\wpml-translation-management\inc\translation-jobs\helpers\wpml-translation-job-helper-with-api.class.php on line 15

Workaround

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 );