Skip Navigation

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.

WordPress 6.7 has introduced a new issue that impact translations, please update WooCommerce and WPML to the latest versions before you report issues. More about this here - https://wpml.org/errata/php-error-wp-6-7-notice-function-_load_textdomain_just_in_time-was-called/
Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 -
- 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 -

Supporter timezone: Europe/Bucharest (GMT+03:00)

This topic contains 18 replies, has 8 voices.

Last updated by mikeD-5 9 months ago.

Assisted by: Radu.

Author Posts
April 4, 2020 at 12:53 am #5835965

mikeD-5

I have a plugin in mu-plugins, and WMPL seems unable to scan the files. It's set up like in the attachment.

When I try to scan the file, it gets no further than the loader, doesn't load the text domain, and doesn't scan any of the files.

Is there a trick to get this to work, or is there a process to add paths for WPML to find what it needs?

Screen Shot 2020-04-03 at 7.39.00 PM.jpg
Screen Shot 2020-04-03 at 7.39.09 PM.jpg
Screen Shot 2020-04-03 at 8.51.40 PM.jpg
April 6, 2020 at 7:53 am #5845057

Radu

Hey Mike,

Thank you for reaching out to the WPML support!

Can you try to move the plugin to the wp-content/plugins folder, scan it for strings, and then move it back to the mu-plugins folder? This might do the trick and have it scanned for strings.

Please give this a try and tell me how it goes.

Thanks,
Radu

April 8, 2020 at 9:22 pm #5869967

mikeD-5

This answer suggests that this is a known issue that can't be resolved without back flips like this. I can't just move the plugin around in this way, the entire site is under revision control and this is unrealistic.

Shall I just assume that this is beyond WPML's capability for now?

April 10, 2020 at 1:06 pm #5884163

Radu

Hey Mike,

There shouldn't be any issue scanning the plugin from the /mu-plugins/ folder. I just created a simple plugin where I added just this code:

function mu_plugin_test_function(){
    echo __('this is my test', 'my-basics-plugin');
}
add_action('wp_footer','mu_plugin_test_function');

and the this is my test was scanned once I went to WPML → Theme and plugins localization and scanned the test plugin I created.

Now, there are two more things you can try, other than temporarily moving the plugin to the /plugins/ folder:
1. Make sure that the WP memory limit is at least 128M (256M recommended) - https://wpml.org/home/minimum-requirements/. You can check this value on WPML → Support area. Sometimes, the strings scanning process is not working well if the memory limit is too low;
2. Deactivate all the plugins except for WPML, activate a default theme like Twenty Twenty, and try again to scan the mu-plugin for strings. This way we can make sure that the other plugins that you're using (or the theme) are not the ones causing this issue.

Thanks,
Radu

April 10, 2020 at 1:09 pm #5884193

Radu

Hey Mike,

I looked on the WordPress Codes and I found this about the /mu-plugins/:
WordPress only looks for PHP files right inside the mu-plugins directory, and (unlike for normal plugins) not for files in subdirectories. You may want to create a proxy PHP loader file inside the mu-plugins directory

Ref: https://wordpress.org/support/article/must-use-plugins/#caveats

Since WPML is made to follow the way that WordPress works, you might need to make the change as explained in the Codes and give the scan one more try.

Thanks,
Radu

April 10, 2020 at 1:18 pm #5884251

mikeD-5

Please re-read the ticket and look at the attached screen shot.

1. The plugin is in a folder ('liberal-core')
2. The plugin has a loader that works ('loader-liberal-core.php')

The issue is with WPML, not the plugin.

Try this. Take your plugin that scanned correctly, put it into a subfolder, add a loader, and then see if WPML picks up the strings. Make sure to change them so you're not simply getting the previous scan.

Let me know what you find.

April 13, 2020 at 6:19 pm #5898577

Radu

Hey Mike,

I tested this one as you explained and I was able to replicate the same behavior. I tried to find why is this happening but it seems that this is more complex than I expected. That's why I asked my colleagues for more details about this. I will keep you posted as soon as I have any updates from them.

In the meantime, temporarily moving the plugin into the /plugins/ folder lets you scan it for strings (until I get some updates about this).

Thanks,
Radu

April 16, 2020 at 2:15 pm #5924011

mikeD-5

keepalive

April 20, 2020 at 5:26 am #5945287

Radu

Hey Mike,

I will keep you posted about the progress we're making on this. For now, my colleagues found the part that's making the strings from must-use plugins not be scanned. They are still talking about how we should fix this one.
I will definitely let you know about what we'll do about the strings from the must-use plugins.

Thanks,
Radu

January 10, 2022 at 9:45 pm #10321963

Ryan

Hello! Was this ever resolved?

Thanks,
Ryan

February 11, 2022 at 6:27 pm #10563181

Ryan

Hello! Just following up on this. Would it be better to open a new ticket? I'm facing the same issue as Mike reported, since we use a similar structure, and it's a pretty common practice for mu-plugins that are more complex.

Thanks,
Ryan

March 15, 2022 at 1:03 am #10788393

mikeD-5

"I will definitely let you know about what we'll do about the strings from the must-use plugins."

Coming up on 2 years since this issue was verified and I have come up against it again. Is there any movement on this at all?

March 23, 2022 at 2:07 pm #10858201

Radu

Hey Mike,

I checked the status of this thread and there's no update about it for now. Our plugin is made to handle the plugins returned by wp_get_mu_plugins, from what my colleagues mentioned in our internal thread. We need to make some changes to our plugin to be able to handle more complex MU plugins.
I will update the status on this ticket as soon as my colleagues will investigate this a bit closer and make the needed changes.

Regards,
Radu

May 5, 2022 at 1:30 pm #11159833

Pascal Hammerli

Hi,
We have same issue here, WPML doesn't scan files that are included/required in MU-plugins, only the "init" file.

So for example a MU-plugin containing: (from PHP recommended structure)
<?php // mu-plugins/load.php
require WPMU_PLUGIN_DIR.'/my-plugin/my-plugin.php'; ?>

--> nothing is scanned on the "proxied" file my-plugin.php

July 25, 2022 at 1:44 pm #11733195

stephW

Hello,

We also have this issue, so a +1 for getting it fixed. I understand this works in "the WordPress way" in that it uses wp_get_mu_plugins() - but it doesn't reflect the way a lot of developers build large/complex WordPress sites.

It'd be great to see this way of working supported in WPML; even if it is via filter where we have to manually include files (ideally just the main plugin file within each subdirectory).

Thanks.