Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
I am maintaining 300+ WordPress sites that use the WPML plugin with an external content push setup. After the Translation Management plugin was merged into the WPML core, the user experience has become almost unusable. I attempted to disable the translation features using WPML_DO_NOT_LOAD_EMBEDDED_TM in wp-config.php, but I am encountering a fatal error in the log.

Solution:
This Constast will be removed from our docs and is not longer a valid one.

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.

Tagged: 

This topic contains 5 replies, has 3 voices.

Last updated by hiddeM 1 year, 9 months ago.

Assisted by: Andreas.

Author Posts
February 9, 2023 at 10:18 pm #13003025

stefanK-72

Hi there,

I maintain 300+ WordPress Sites that use the WPML plugin, but with a little bit "uncommon" setup. All content is produced and translated externally. The final content is then pushed into WordPress.
We only need the basic WPML features without translation management. WPML was the perfect fit until you started to merge the Translation Management plugin into WPML core.
Currently the user expericence is almost unusable. Every external content push into WordPress triggers the translation management, creates jobs and so on...

I found the option WPML_DO_NOT_LOAD_EMBEDDED_TM and try to disable all the translation features. Added this to wp-config.php

Config::define( 'WPML_DO_NOT_LOAD_EMBEDDED_TM', true );

Now WPML in the WP backend looks pretty good again. As in the old versions, without all the translation stuff that I don't want.
But it's not working as expected. I get a fatal error in the log.

[09-Feb-2023 21:23:20 UTC] PHP Warning:  Use of undefined constant WPML_TM_PATH - assumed 'WPML_TM_PATH' (this will throw an Error in a future version of PHP) in /var/www/vhosts/report-base/current/web/app/plugins/sitepress-multilingual-cms/inc/functions-load-tm.php on line 319
[09-Feb-2023 21:23:20 UTC] PHP Stack trace:
[09-Feb-2023 21:23:20 UTC] PHP   1. {main}() /var/www/vhosts/report-base/current/web/wp/wp-admin/admin-ajax.php:0
[09-Feb-2023 21:23:20 UTC] PHP   2. require_once() /var/www/vhosts/report-base/current/web/wp/wp-admin/admin-ajax.php:22
[09-Feb-2023 21:23:20 UTC] PHP   3. require_once() /var/www/vhosts/report-base/current/web/wp/wp-load.php:55
[09-Feb-2023 21:23:20 UTC] PHP   4. require_once() /var/www/vhosts/report-base/current/web/wp-config.php:9
[09-Feb-2023 21:23:20 UTC] PHP   5. do_action() /var/www/vhosts/report-base/current/web/wp/wp-settings.php:480
[09-Feb-2023 21:23:20 UTC] PHP   6. WP_Hook->do_action() /var/www/vhosts/report-base/current/web/wp/wp-includes/plugin.php:517
[09-Feb-2023 21:23:20 UTC] PHP   7. WP_Hook->apply_filters() /var/www/vhosts/report-base/current/web/wp/wp-includes/class-wp-hook.php:332
[09-Feb-2023 21:23:20 UTC] PHP   8. wpml_tm_load_and_intialize_dashboard_ajax() /var/www/vhosts/report-base/current/web/wp/wp-includes/class-wp-hook.php:308
[09-Feb-2023 21:23:20 UTC] PHP   9. wpml_tm_load_tm_dashboard_ajax() /var/www/vhosts/report-base/current/web/app/plugins/sitepress-multilingual-cms/inc/functions-load-tm.php:342
[09-Feb-2023 21:21:17 UTC] PHP Warning:  require_once(WPML_TM_PATH/menu/dashboard/wpml-tm-dashboard-ajax.class.php): failed to open stream: No such file or directory in /var/www/vhosts/report-base/current/web/app/plugins/sitepress-multilingual-cms/inc/functions-load-tm.php on line 319
[09-Feb-2023 21:21:17 UTC] PHP Stack trace:
[09-Feb-2023 21:21:17 UTC] PHP   1. {main}() /var/www/vhosts/report-base/current/web/wp/wp-admin/admin-ajax.php:0
[09-Feb-2023 21:21:17 UTC] PHP   2. require_once() /var/www/vhosts/report-base/current/web/wp/wp-admin/admin-ajax.php:22
[09-Feb-2023 21:21:17 UTC] PHP   3. require_once() /var/www/vhosts/report-base/current/web/wp/wp-load.php:55
[09-Feb-2023 21:21:17 UTC] PHP   4. require_once() /var/www/vhosts/report-base/current/web/wp-config.php:9
[09-Feb-2023 21:21:17 UTC] PHP   5. do_action() /var/www/vhosts/report-base/current/web/wp/wp-settings.php:480
[09-Feb-2023 21:21:17 UTC] PHP   6. WP_Hook->do_action() /var/www/vhosts/report-base/current/web/wp/wp-includes/plugin.php:517
[09-Feb-2023 21:21:17 UTC] PHP   7. WP_Hook->apply_filters() /var/www/vhosts/report-base/current/web/wp/wp-includes/class-wp-hook.php:332
[09-Feb-2023 21:21:17 UTC] PHP   8. wpml_tm_load_and_intialize_dashboard_ajax() /var/www/vhosts/report-base/current/web/wp/wp-includes/class-wp-hook.php:308
[09-Feb-2023 21:21:17 UTC] PHP   9. wpml_tm_load_tm_dashboard_ajax() /var/www/vhosts/report-base/current/web/app/plugins/sitepress-multilingual-cms/inc/functions-load-tm.php:342
[09-Feb-2023 21:21:17 UTC] PHP Fatal error:  require_once(): Failed opening required 'WPML_TM_PATH/menu/dashboard/wpml-tm-dashboard-ajax.class.php' (include_path='.:/usr/share/php') in /var/www/vhosts/report-base/current/web/app/plugins/sitepress-multilingual-cms/inc/functions-load-tm.php on line 319
[09-Feb-2023 21:21:17 UTC] PHP Stack trace:
[09-Feb-2023 21:21:17 UTC] PHP   1. {main}() /var/www/vhosts/report-base/current/web/wp/wp-admin/admin-ajax.php:0
[09-Feb-2023 21:21:17 UTC] PHP   2. require_once() /var/www/vhosts/report-base/current/web/wp/wp-admin/admin-ajax.php:22
[09-Feb-2023 21:21:17 UTC] PHP   3. require_once() /var/www/vhosts/report-base/current/web/wp/wp-load.php:55
[09-Feb-2023 21:21:17 UTC] PHP   4. require_once() /var/www/vhosts/report-base/current/web/wp-config.php:9
[09-Feb-2023 21:21:17 UTC] PHP   5. do_action() /var/www/vhosts/report-base/current/web/wp/wp-settings.php:480
[09-Feb-2023 21:21:17 UTC] PHP   6. WP_Hook->do_action() /var/www/vhosts/report-base/current/web/wp/wp-includes/plugin.php:517
[09-Feb-2023 21:21:17 UTC] PHP   7. WP_Hook->apply_filters() /var/www/vhosts/report-base/current/web/wp/wp-includes/class-wp-hook.php:332
[09-Feb-2023 21:21:17 UTC] PHP   8. wpml_tm_load_and_intialize_dashboard_ajax() /var/www/vhosts/report-base/current/web/wp/wp-includes/class-wp-hook.php:308
[09-Feb-2023 21:21:17 UTC] PHP   9. wpml_tm_load_tm_dashboard_ajax() /var/www/vhosts/report-base/current/web/app/plugins/sitepress-multilingual-cms/inc/functions-load-tm.php:342

sitepress.php line 441:

if ( ! defined('WPML_DO_NOT_LOAD_EMBEDDED_TM' ) || ! WPML_DO_NOT_LOAD_EMBEDDED_TM ) {
	WPML\Plugins::loadEmbeddedTM( $sitepress->is_setup_complete() );
}

Plugins.php (loadEmbeddedTM) line 84:
-> tm.php is not loaded because $isTMAllowed is false

			if ( ! $isSetupComplete || $isTMAllowed ) {
				require_once WPML_PLUGIN_PATH . '/tm.php';
			}

tm.php line 15:
-> constant WPML_TM_PATH would be set here, but as the file isn't loaded it is not available when the other files access it

// Do not uncomment the following line!
// If you need to use this constant, use it in the wp-config.php file.
if ( ! defined( 'WPML_TM_PATH' ) ) {
	define( 'WPML_TM_PATH', dirname( __FILE__ ) );
}

The comment there suggest setting WPML_TM_PATH in the wp-config.php. So I do that.

Config::define( 'WPML_TM_PATH', '/var/www/vhosts/report-base/current/web/app/plugins/sitepress-multilingual-cms/' );

The previous errors disappear then. I am editing an article and get another error: WPML_Meta_Boxes_Post_Edit_HTML->translation_priority()

[09-Feb-2023 21:48:24 UTC] PHP Notice:  Trying to get property 'term_id' of non-object in /var/www/vhosts/report-base/current/web/wp/wp-includes/class-wp-walker.php on line 139
[09-Feb-2023 21:48:24 UTC] PHP Stack trace:
[09-Feb-2023 21:48:24 UTC] PHP   1. {main}() /var/www/vhosts/report-base/current/web/wp/wp-admin/post.php:0
[09-Feb-2023 21:48:24 UTC] PHP   2. require() /var/www/vhosts/report-base/current/web/wp/wp-admin/post.php:187
[09-Feb-2023 21:48:24 UTC] PHP   3. the_block_editor_meta_boxes() /var/www/vhosts/report-base/current/web/wp/wp-admin/edit-form-blocks.php:316
[09-Feb-2023 21:48:24 UTC] PHP   4. do_meta_boxes() /var/www/vhosts/report-base/current/web/wp/wp-admin/includes/post.php:2249
[09-Feb-2023 21:48:24 UTC] PHP   5. SitePress->meta_box() /var/www/vhosts/report-base/current/web/wp/wp-admin/includes/template.php:1409
[09-Feb-2023 21:48:24 UTC] PHP   6. WPML_Meta_Boxes_Post_Edit_HTML->render_languages() /var/www/vhosts/report-base/current/web/app/plugins/sitepress-multilingual-cms/sitepress.class.php:2070
[09-Feb-2023 21:48:24 UTC] PHP   7. WPML_Meta_Boxes_Post_Edit_HTML->translation_priority() /var/www/vhosts/report-base/current/web/app/plugins/sitepress-multilingual-cms/menu/post-menus/post-edit-screen/wpml-meta-boxes-post-edit-html.class.php:59
[09-Feb-2023 21:48:24 UTC] PHP   8. wp_dropdown_categories() /var/www/vhosts/report-base/current/web/app/plugins/sitepress-multilingual-cms/menu/post-menus/post-edit-screen/wpml-meta-boxes-post-edit-html.class.php:144
[09-Feb-2023 21:48:24 UTC] PHP   9. walk_category_dropdown_tree() /var/www/vhosts/report-base/current/web/wp/wp-includes/category-template.php:464
[09-Feb-2023 21:48:24 UTC] PHP  10. Walker_CategoryDropdown->walk() /var/www/vhosts/report-base/current/web/wp/wp-includes/category-template.php:1146
[09-Feb-2023 21:48:24 UTC] PHP  11. Walker_CategoryDropdown->display_element() /var/www/vhosts/report-base/current/web/wp/wp-includes/class-wp-walker.php:205
[09-Feb-2023 21:48:24 UTC] PHP Notice:  Trying to get property 'name' of non-object in /var/www/vhosts/report-base/current/web/wp/wp-includes/class-walker-category-dropdown.php on line 65
[09-Feb-2023 21:48:24 UTC] PHP Stack trace:
[09-Feb-2023 21:48:24 UTC] PHP   1. {main}() /var/www/vhosts/report-base/current/web/wp/wp-admin/post.php:0
[09-Feb-2023 21:48:24 UTC] PHP   2. require() /var/www/vhosts/report-base/current/web/wp/wp-admin/post.php:187
[09-Feb-2023 21:48:24 UTC] PHP   3. the_block_editor_meta_boxes() /var/www/vhosts/report-base/current/web/wp/wp-admin/edit-form-blocks.php:316
[09-Feb-2023 21:48:24 UTC] PHP   4. do_meta_boxes() /var/www/vhosts/report-base/current/web/wp/wp-admin/includes/post.php:2249
[09-Feb-2023 21:48:24 UTC] PHP   5. SitePress->meta_box() /var/www/vhosts/report-base/current/web/wp/wp-admin/includes/template.php:1409
[09-Feb-2023 21:48:24 UTC] PHP   6. WPML_Meta_Boxes_Post_Edit_HTML->render_languages() /var/www/vhosts/report-base/current/web/app/plugins/sitepress-multilingual-cms/sitepress.class.php:2070
[09-Feb-2023 21:48:24 UTC] PHP   7. WPML_Meta_Boxes_Post_Edit_HTML->translation_priority() /var/www/vhosts/report-base/current/web/app/plugins/sitepress-multilingual-cms/menu/post-menus/post-edit-screen/wpml-meta-boxes-post-edit-html.class.php:59
[09-Feb-2023 21:48:24 UTC] PHP   8. wp_dropdown_categories() /var/www/vhosts/report-base/current/web/app/plugins/sitepress-multilingual-cms/menu/post-menus/post-edit-screen/wpml-meta-boxes-post-edit-html.class.php:144
[09-Feb-2023 21:48:24 UTC] PHP   9. walk_category_dropdown_tree() /var/www/vhosts/report-base/current/web/wp/wp-includes/category-template.php:464
[09-Feb-2023 21:48:24 UTC] PHP  10. Walker_CategoryDropdown->walk() /var/www/vhosts/report-base/current/web/wp/wp-includes/category-template.php:1146
[09-Feb-2023 21:48:24 UTC] PHP  11. Walker_CategoryDropdown->display_element() /var/www/vhosts/report-base/current/web/wp/wp-includes/class-wp-walker.php:205
[09-Feb-2023 21:48:24 UTC] PHP  12. Walker_CategoryDropdown->start_el() /var/www/vhosts/report-base/current/web/wp/wp-includes/class-wp-walker.php:147

Did I miss something? Can you tell me how to configure WPML_DO_NOT_LOAD_EMBEDDED_TM correctly?

Thank you.

My test setup was a clean test install with WP 6.1.1 and WPML 4.5.14 and Twenty Twenty-Two theme. No other plugins installed. Clean fresh database with WPML wizard completed and two languages configured.

February 10, 2023 at 2:55 pm #13008031

Andreas

Hello there

Thank you for contacting us. I am happy to help you.

The Constant should be used out of the box normally. I need to check it further.

I can see the same problem as you.

I will come back to you when I am having news.

Regards,
Andreas

February 13, 2023 at 12:37 pm #13020193

Andreas

Thank you for waiting for me.

I escalated the ticket as I told you because indeed there is an issue. Let's see if we can have a proper workaround on this.

Regards,
Andreas

February 14, 2023 at 4:02 pm #13032723

Andreas

Hello there.

The issue escalated to our developers.

As workaround I am suggesting this :

1) Remove the constant from wp-config.
2) Download the plugin hidden link
3) Go to wp-content/mu-plugins if the mu-plugins directory does not exist create one.
4) Copy the plugin to the mu-plugins directory

It should work s you need it.

I hope this helps. Please let us know how it goes or if you need any further assistance. I'll gladly help you. 🙂

Regards,
Andreas

February 16, 2023 at 3:58 pm #13050771

stefanK-72

I integrated the proposed MU plugin into my test setup and removed all WPML constants from wp-config. No more errors in the log now. WP backend looks now as expected, without any translation management. Post editing is correct and when editing and saving a translation it gets no longer the "sync" icon. No translation jobs are generated and all icl_translation_* tables stay empty as expected.

Or shortly said: Everything perfect now!

Thank you very much for your support, Andreas.

February 17, 2023 at 9:48 am #13055829

hiddeM

I would also be interested in this MU plugin for I'm having the same issues. However this link is hidden. Could you share the link to the MU plugin with me? Thank you so much.

*Edit* I've managed by putting the constant in a php file in the mu-plugin folder. Thanks anyway.