I have encountered a problem I think is related to Polylang. The problem is that my custom post types (CPTs) don’t show up as results in the main WP search.
On the site in question, I use various CPTs, set up in custom plugins. These are all set to public. I use ACF Pro, Polylang free and Yoast free (in addition to a few other plugins that I don’t believe to be a part of the problem). I have set up Yoast to show all CPTs in search. I have also tried to deactivate Yoast, to see if this plugin is the culprit, with no change in the search results.
I have also tried the often mentioned «pre_get_posts» filter, but as you will see below, some CPTs (those that are translated in Polylang) actually show up, and thus the problem does not seem to be that the CPTs are not picked up by the main WP search as such. I have also verified that all the CPTs are in the main WP search SQL select phrase (by echoing $wp_query->request). They seem to be filtered out at a later stage, I believe by Polylang.
The only CPT that actually does show up in the search results is the only CPT I have selected to be translated in Polylang.
When I add «&post_type=my_cpt» in the search URL (where my_cpt is the name of one of the untranslated CPTs), this post type shows up, but then of course no other search results (posts, pages, other CPTs) show up.
I translated one of the other CPTs, just to see if this did the trick, and when translated the CPT does show up in the main WP search.
The thing is – I don’t want to translate these other CPTs. What I would like is for them to show up in all languages, untranslated. I would also expect that Polylang don’t filter out untranslated public CPTs from the main WP search results.
wpml-config.xml and the likes only seem to affect which CPTs are available in the settings for translation or to hardcode them to be translated or not – it does not help make untranslated CPTs show up in the main search.
I would also like to mention that I am very happy with the Polylang plugin, and thankful to the developers for releasing this great plugin for free. But it has given me some headache lately, so…
Any ideas on how I can make Polylang «behave»?