When querying multiple post_types via get_posts, there was one specific post type that didn’t show up in combination with posts or pages. Querying only that specific post type worked fine, but the combination failed, every – single – time.
After running the same arguments in a WP_Query and checking out the SQL that it used I noticed a specific term relation was injected in the SQL string. I searched the database for this specific term and it turned out to be a language term from Polylang.
Because posts and pages are automatically translated these show up fine in the query. But the other post type was not defined as supported. But, since Polylang finds supported post type, it does customise the query so that it only returns results for the english language.
The solution was easy: Go to Polylang settings and mark the post type as a supported one. Then, mark all posts in the post type as english versions.
As a result, the webinar posts now comply and all posts are showing fine!
Thank you very much, you saved me many hours of searching for solution to this problem!
Marinus Klasen says