Problem:
I am trying to change/add the language code in the development site but I faced the following error:
PHP Fatal error: Uncaught Error: Call to undefined method WP_Error::filter() in .../wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Fns.php:202
Solution:
The issue happened because the site's URL was changed, in this case, WPML will detect the change and show a banner asking if the site was moved/Copied to the new URL.
Kindly select if the site was moved to the current URL or if this is a copy of the main site then try again to add the language.