WPML – Set language of inserted post

The wpml_set_element_language_details action element_type need to be with the correct prefix that WPML use:

From the WPML Docs

element_type(string) The type of an element. Can be a post type: post_post, post_page, post_attachment, post_nav_menu_item, post_{custom post key} or taxonomy: tax_category, tax_post_tag, tax_nav_menu, tax_{custom taxonomy key}. Defaults to post_post if not set.

In your case it should be post_projects but you can also use wpml_element_type to get the correct prefix like this:

$element_type = apply_filters('wpml_element_type', 'projects');

Resources:

https://wpml.org/wpml-hook/wpml_set_element_language_details/

https://wpml.org/wpml-hook/wpml_element_type/