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.

This topic contains 7 replies, has 2 voices.

Last updated by anaA-13 1 year, 3 months ago.

Assigned support staff: Izzi Hassan.

Author Posts
September 30, 2019 at 1:34 pm #4664879


Tell us what you are trying to do?

find out what folder private function scan_template_paths( $dirs_to_scan ) scans

Is there any documentation that you are following?N/A

Is there a similar example that we can see?

What is the link to your site?
local staging

October 1, 2019 at 7:41 am #4669213

Izzi Hassan

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)


Thank you for reaching out to WPML Support.

By default, the function scans the templates folder in your theme's wpml folder:

It can be modified by using the "wpml_ls_directories_to_scan" filter in your theme or plugin file, which you can read more about here:

Please let us know if you require further assistance or information about this topic.

October 1, 2019 at 8:46 am #4669753


Thank you this is helpful, so the problem i'm having is we have the upload folder blocked using pout s3 bucket. we get a error when we activate this plugin. if we comment out the can dir function it stops this error and works.

October 1, 2019 at 8:49 am #4669761

Izzi Hassan

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)


Could you share the error you receive so we can get a better idea of what's happening?

October 1, 2019 at 8:51 am #4669763


sure any chance we ca take this into a chat

October 1, 2019 at 8:58 am #4669799


this is the error

Warning: scandir(): S3_Uploads_Stream_Wrapper::dir_readdir is not implemented! in /var/www/html/wp-content/plugins/sitepress-multilingual-cms/classes/language-switcher/class-wpml-ls-templates.php on line 175

Fatal error: Uncaught exception 'Aws\S3\Exception\S3Exception' with message 'Error executing "ListObjects" on "hidden link

October 1, 2019 at 10:16 am #4670921

Izzi Hassan

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Unfortunately, I am not able to convert this ticket into a chat.

I see that you had recently brought this issue to our attention in another ticket:

Bruno has already escalated the problem to our Tier 2 support and you can respond there to let them know your issue has not been resolved. Please close out this and any other tickets you have open for this issue and let Bruno know that you need further assistance.

In the meantime, I'd like to suggest a quick fix that will not be overwritten by plugin updates:

There really shouldn't be any reason WPML is trying to scan your uploads folder for templates so I'm not sure why S3 Uploads is getting involved.

Without getting into debugging the actual error, if your theme is not providing custom templates for WPML Language Switchers, you can try adding the following code to your theme's functions.php file.

This will effectively disable scanning for custom language switcher templates, without needing to comment out anything in WPML's core files:

function wpmlhook_ls_dirs_to_scan( $dirs ) {
    $dirs = [];
    return $dirs;
add_filter( 'wpml_ls_directories_to_scan', 'wpmlhook_ls_dirs_to_scan' );

Please also share some debugging information below so we can have an idea of what plugins and theme you are using for us to investigate this compatibility issue properly:

October 1, 2019 at 10:22 am #4670989


My issue is resolved now. Thank you!