Translated and untranslated post types in the same get_posts
-
I don’t know if this is a bug or whats the correct way to do it, but we have a website that has a search that uses get_posts. The search includes both, translatable custom post types and untranslatable post types. If we just use get_posts then the untranslated post types are completely ignored and only posts from the current language are displayed.
Is there a way to get both, posts from the current language AND untranslated posts in the same get_posts? Is there an official way to do this? We use similiar get_posts to this:
get_posts([ 'post_type' => 'any', 's' => 'searchterm' ])
We have a temporary workaround, we just added
'lang' => ''
to the get_posts and removed all posts from other languages from the results. Not optimal.
Is there a better way to do this correctly?
- The topic ‘Translated and untranslated post types in the same get_posts’ is closed to new replies.