This thread is resolved. Here is a description of the problem and solution.
Problem: The client is trying to activate the WPML plugin but encounters a fatal error due to an undefined function
str_contains()
. This issue typically occurs when using outdated versions of WordPress and PHP.
Solution: 1. Ensure that both WordPress and PHP are updated to the latest versions. WPML is designed to work with the most recent versions of WordPress and PHP, which can prevent such errors. 2. If you're using WordPress versions older than 5.9 and PHP versions older than 8.0, you might need to manually define the
str_contains()
function to resolve the error. 3. Before making any updates, we recommend performing a full website backup to safeguard your data. 4. If you prefer to use an older version of WPML, you can create a backup, remove the current WPML plugin, and install WPML version 4.6.7 from here.
If this solution doesn't look relevant to your situation, please open a new support ticket in the 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.
Tell us what you are trying to do? I want to activate sitepress-multilingual-cms
What is the link to your site? hidden link
Fatal error: Uncaught Error: Call to undefined function str_contains() in /var/www/html/blog/wp-content/plugins/sitepress-multilingual-cms-backup/classes/request-handling/wpml-request.class.php:123 Stack trace: #0 /var/www/html/blog/wp-content/plugins/sitepress-multilingual-cms-backup/classes/request-handling/class-wpml-language-resolution.php(87): WPML_Request->show_hidden() #1 /var/www/html/blog/wp-content/plugins/sitepress-multilingual-cms-backup/classes/language/Detection/CookieLanguage.php(43): WPML_Language_Resolution->is_language_active(NULL) #2 /var/www/html/blog/wp-content/plugins/sitepress-multilingual-cms-backup/classes/request-handling/wpml-request.class.php(95): WPML\Language\Detection\CookieLanguage->get('wp-wpml_current...') #3 /var/www/html/blog/wp-content/plugins/sitepress-multilingual-cms-backup/classes/language/Detection/Backend.php(45): WPML_Request->get_cookie_lang() #4 /var/www/html/blog/wp-content/plugins/sitepress-multilingual-cms-backup/vendor/wpml/collect/src/Illuminate/Support/helpers.php(26): W in /var/www/html/blog/wp-content/plugins/sitepress-multilingual-cms-backup/classes/request-handling/wpml-request.class.php on line 123
Notice: is_embed was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /var/www/html/blog/wp-includes/functions.php on line 5663
Notice: is_search was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /var/www/html/blog/wp-includes/functions.php on line 5663
So, do I have to install the other version? What version you recommended to install? or do I have to ask for refund as it not possible to install right now?
If using WordPress versions older than 5.9 with PHP versions older than 8, you may need to define that function manually to avoid errors.
To get rid of this error, my recommendation would be to run a full website backup first and then make sure that your WordPress and PHP versions are up to date, using the latest version available. After that, WPML should work perfectly fine.
It is usually recommended that you are using the very latest versions of any product (plugin/theme) that you are using on your site.
This is not advice related specifically to WPML but to any plugin or theme that is used on a WordPress site - this will keep the site secure (by not using older versions).
Of course, if that's what you want, you can try to create a full website backup, remove the current WPML plugin, and then download the 4.6.7 version from here (https://wpml.org/download/wpml-multilingual-cms/?section=changelog) and install this one to see if the issue is still there.
Mihai
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.