Home›Support›English Support›[Resolved] Fatal error: Uncaught InvalidArgumentException: target should be an object with
[Resolved] Fatal error: Uncaught InvalidArgumentException: target should be an object with
This thread is resolved. Here is a description of the problem and solution.
Problem: The client was experiencing a fatal error when switching to Spanish content, with an error message indicating an 'InvalidArgumentException' Solution: We're not sure about what's causing the issue because our developers couldn't reproduce it on our servers but here is a quick workaround.
1. Access your server files using FTP or Cpanel. 2. Navigate to
FYI - I have just set the site back to use the Classic translation editor for both new and previously created posts. Feel free to change any settings you like.
1) I deleted the Spanish translation for the page Accommodation (I listed all Spanish pages, deleted the Spanish translation of the accommodation page and permanently deleted the page from trash).
2) Using the classic editor, I started the process of adding a Spanish translation.
3) I pressed "overwrite with English content" and pressed OK to the warning popup.
4) My intention was then to press "Translate independently". However, before I could do this the "InvalidArgumentException" was displayed. See screenshot.
Thank you for the updates! I have made sure to include them for our team.
Regarding your move from the Advanced Translation Editor to the Classic Editor, I understand you said you do not want to use the Advanced Translation Editor and Automatic Tranlsation, however, do note that you can remain using the Advanced Translation Editor even without the automatic translation.
This is important as if you do your translations in the Advanced Translation Editor they do not copy over to the classic editor.
The classic editor saves the translations in the database whereas the advanced translation editor saves them in the cloud therefore the 2 do not communicate.
When I edit the Accommodations page for example, If I switch to the advanced editor and access the translation I can see that this was the editor used before.
Nevertheless, even though I switch back to the ATE and update the default language and translation the issue is still triggered. Once I have some updates from our team I will update you.
I'm keen to get an update on this issue. It has happened again with another site. I have just copied this site (hidden link) over to Siteground at this URL (hidden link). We are seeing exactly the same problem - when we try to view the Spanish translation of any page other than the homepage we get the same error:
Fatal error: Uncaught InvalidArgumentException: target should be an object with filter method or an array in /home/customer/www/website2023.ailmalaga.com/public_html/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Fns.php:207 Stack trace: #0 [internal function]: WPML\FP\Fns::WPML\FP\{closure}(Object(Closure), false) #1 /home/customer/www/website2023.ailmalaga.com/public_html/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(154): call_user_func_array(Object(Closure), Array) #2 /home/customer/www/website2023.ailmalaga.com/public_html/wp-content/plugins/sitepress-multilingual-cms/classes/wp-core-hooks/post/class-wpml-remove-pages-not-in-current-language.php(48): WPML\FP\{closure}(false) #3 /home/customer/www/website2023.ailmalaga.com/public_html/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php(2269): WPML_Remove_Pages_Not_In_Current_Language->filter_pages(false, Array) #4 /home/customer/www/website2023.ailmalaga.com/public_html/wp-includes/class-wp-hook.php(31 in /home/customer/www/website2023.ailmalaga.com/public_html/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Fns.php on line 207
This is now getting extremely frustrating - we need to get these sites live and this WPML malfunction is standing in the way. I'm struggling to understand why we're seeing errors with multiple site, but not with this site - hidden link. In terms of inheritance, this site is the sibling of website2023.ailmalaga.com and the parent of website2023.ailespanol.com. I can't understand why one site works perfectly but the other two fail.
Could you let me know what your 2nd line team has discovered?
The thread describes exactly the same issue as the one we are seeing. The thread is also marked as resolved. Perhaps you could check in with the engineer who handled this support request (https://wpml.org/es/forums/users/carlos-r/)
We're not sure about what's causing the issue because our developers couldn't reproduce it on our servers but here is a quick workaround.
- Access your server files via FTP or Cpanel
- Edit wp-content/plugins/sitepress-multilingual-cms/classes/wp-core-hooks/post/class-wpml-remove-pages-not-in-current-language.php
- Around line 34 replace:
Thanks for all the good suggestions and for finding a workaround.
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.