Skip Navigation

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

Problem:
The client was experiencing a fatal error on their website caused by the WPML String Translation plugin when using PHP version 8.3. The error message indicated an ArgumentCountError due to an incorrect number of arguments passed to a function in the plugin.
Solution:
We recommended reverting the PHP version from 8.3.10 to 8.0.30 as a temporary fix, which resolved the fatal error and restored site access. Additionally, we advised the client to ensure their site is backed up before making changes and to check for any custom code that might be causing the plugin to load incorrectly. Specifically, they should look for and remove the line

do_action('wpml_before_init');

if found in their theme's functions.php file or any custom plugins.

If this solution does not apply to your case, or if it becomes outdated, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If further assistance is needed, please open a new support ticket at WPML support forum.

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 13 replies, has 0 voices.

Last updated by Carlos Rojas 1 month ago.

Assisted by: Carlos Rojas.

Author Posts
May 6, 2025 at 7:47 pm #17003408

manuelN-2

Background of the issue:
I am trying to resolve a fatal error on our website caused by the wpml-string-translation plugin. The error message is: <code>Fatal error: Uncaught ArgumentCountError: 3 arguments are required, 2 given in wpml-string-translation/classes/translations-file-scan/wpml-st-translations-file-registration.php on line 100</code>. The stack trace indicates an issue with the save_file_info() function calling sprintf() with an incorrect number of arguments. This error occurs when the plugin is active, breaking the entire site. For now, we’ve disabled the plugin to restore site access. Website: hidden link. Link to a page where the issue can be seen: hidden link. WPML String Translation version: 3.3.3, PHP version: 8.3.10, WordPress version: 6.8.1. Other WPML plugins installed: WPML Multilingual CMS, WPML Media Translation.

Symptoms:
The website experiences a fatal error due to the wpml-string-translation plugin, specifically an ArgumentCountError in the wpml-st-translations-file-registration.php file on line 100, related to the save_file_info() function.

Questions:
How can I fix the ArgumentCountError in the wpml-string-translation plugin?
Is there a workaround to use the plugin without causing a fatal error?

May 7, 2025 at 9:11 am #17005219

Kor
WPML Supporter since 08/2022

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thanks for contacting us. It looks like your issue is similar to this one https://wpml.org/forums/topic/fatal-error-uncaught-argumentcounterror-10-arguments-are-required-2-given/ .

I will need to closely examine your website. Therefore, I will require temporary access (WP-Admin and FTP) to a test site where the problem has been replicated, if possible. This will enable me to provide better assistance and determine if any configurations need to be modified.

Please note that it is important to have a backup for security purposes and to prevent any potential data loss. You can use the UpdraftPlus plugin (https://wordpress.org/plugins/updraftplus/) to fulfill your backup requirements.

Your upcoming reply will be treated with confidentiality and will only be visible to you and me.

✙ To resolve the issue, I may need your consent to deactivate and reactivate plugins and the theme, as well as make configuration changes on the site if necessary. This emphasizes the significance of having a backup.

May 7, 2025 at 9:14 am #17005244

Carlos Rojas
WPML Supporter since 03/2017

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Hi there,
Thank you for contacting us

What’s Causing the Issue

Cannot redeclare icl_st_init()

indicates that WPML’s icl_st_init() function is being declared more than once. This typically happens when the plugin’s code is initialized manually in a way that causes it to be loaded twice.

From your description and based on previous cases, the issue is likely caused by a manual call to:

do_action('wpml_before_init');

This line triggers WPML’s initialization process. Since WPML already handles this automatically, manually calling it can lead to a double inclusion of files—hence the function redeclaration error.

How to Fix It

Please follow these steps:
- Backup your site – If you haven’t done so already, take a full backup before proceeding.
- Check your custom code – Look in your theme’s functions.php file or any custom plugins for:

do_action('wpml_before_init');

- Remove that line – If found, delete it and save the file.
- Clear your caches – If you’re using a caching plugin or server-side cache, clear it.
- Test your site – Reload the page and confirm the error is gone.

Let me know the results of the steps described above
Best regards,
Carlos

May 7, 2025 at 10:10 am #17005481

manuelN-2

Hi Kor and Carlos,

Thanks for your responses. It appears the issue was related to compatibility with PHP 8.3.

We’ve reverted the PHP version from 8.3.10 to 8.0.30. Just a quick temporary fix and the site is now working without the fatal error.

Thanks

May 7, 2025 at 10:18 am #17005539

Carlos Rojas
WPML Supporter since 03/2017

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Great!

Please don't hesitate to contact us if you need our help in the future with WPML.
Have an excellent day!

May 8, 2025 at 10:09 am #17010778

manuelN-2

Hi Kor and Carlos,

Unfortunately, reverting to PHP 8.0.10 only provided a temporary workaround. As soon as we reactivate the WPML String Translation plugin, the site crashes again with the same fatal error:

 
Fatal error: Uncaught ArgumentCountError: 3 arguments are required, 2 given in 
/wpml-string-translation/classes/translations-file-scan/wpml-st-translations-file-registration.php on line 100

The crash occurs consistently upon activation, regardless of PHP version.

We have also carefully followed the steps you suggested regarding do_action('wpml_before_init'):

We checked our theme’s functions.php and all custom plugins — this line is not present anywhere.

We also cleared all site/server caches and confirmed the error still occurs on plugin activation.

Please advise urgently if there is a patch or updated development version available?

I can provide staging site access if that would assist your investigation.

Best regards,

May 8, 2025 at 10:17 am #17010813

Carlos Rojas
WPML Supporter since 03/2017

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Thank you very much for your feedback.

Please share the access credentials to the staging site in your next message, which I have set private. I will take a closer look and I will run some troubleshooting steps.

Looking forward to your message.

May 8, 2025 at 11:21 am #17011298

Carlos Rojas
WPML Supporter since 03/2017

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Thank you for sharing the credentials requested.

However, when I visit hidden link I get redirected to hidden link so I can't see the staging site.

May 8, 2025 at 11:24 am #17011305

manuelN-2

Oh shoot... Yeah, there's and IP redirect when accessing from Spain. Can you use a VPN instead, or give me your IP in private so I can whitelist?

Thanks.

May 8, 2025 at 11:29 am #17011322

Carlos Rojas
WPML Supporter since 03/2017

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Sure!

Here is my public IP: 87.223.242.61

May 8, 2025 at 11:35 am #17011345

manuelN-2

Done! 😉

May 8, 2025 at 11:54 am #17011415

Carlos Rojas
WPML Supporter since 03/2017

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Great! This time I was able to access the staging site.

Do you authorize me to update the theme?

May 8, 2025 at 8:14 pm #17013667

manuelN-2

Sure! Whatever you need to do. Thanks!

May 9, 2025 at 9:18 am #17015521

Carlos Rojas
WPML Supporter since 03/2017

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Thank you for your authorization.

I ran several troubleshooting steps and activated only the WPML plugins, Woocommerce, Elementor & Elementor Pro, and the theme. I can't reproduce the issue, which means that the cause of the issue is a third-party functionality.

Please activate the rest of the plugins, one by one, until the issue appears again and you find the culprit.