This thread is resolved. Here is a description of the problem and solution.
Problem:
You have a custom plugin with a custom post type. When the site's current language is set to a non-default language, such as Dutch, and you create a custom post type, it is only associated with the current language. You tried using
'lang' => 'all'
in WP_Query parameters without success. The issue is that when performing a WP_Query for the custom post type, only records in the default language are shown, filtering out records in other languages.
Solution:
To include custom post types in all languages in your WP_Query, you need to use the
suppress_filters
argument in your query. Here's how you can modify your WP_Query:
1. Set
suppress_filters = true
to fetch posts from all languages.
2. Set
suppress_filters = false
to get posts only in the currently viewed language.
For more detailed information, you can visit the WPML documentation on achieving compatibility for themes and plugins at https://wpml.org/documentation/support/achieving-wpml-compatibility-for-your-themes-and-plugins/#filter-correct-ids.
Please note that this solution might be outdated or not applicable to your specific case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the issue persists, please open a new support ticket at our 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.