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.
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?
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.
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
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.
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.
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.