Background of the issue:
I have my own custom plugin which has implemented a custom post type. If a user has their current language set to a non-default language, such as Dutch, and they create the custom post type, it is associated with the current language by WPML. I tried adding 'lang' => 'all' as an argument to WP_Query parameters but did not get a positive result.
Note that if a user creates the custom post type it will have a post_status pending. WP_Query is used to retrieve an overview of all custom posts with this status.
Symptoms:
When performing a WP_Query for the custom post type, only records in the default language are shown, and records in other languages, like Dutch, are filtered out.
Questions:
How can I modify WP_Query to include custom post types in all languages?
Is there a specific WPML setting that needs to be adjusted to display custom post types in non-default languages?
If you want to retrieve posts from all languages, you need to use the suppress_filters argument in your query.
• Set suppress_filters = true to fetch posts from all languages.
• Set suppress_filters = false to get posts only in the currently viewed language.