Current language in relevanssi_hits_filter
-
I dont know if it is Relevanssi or SearchWP Live Ajax Search that is the correct place to ask this question.
I am using both these plugins together with Polylang to make my site multi language. I would like to strip the search results visible in SearchWP Live Ajax Search so only hits at the current language is shown. I am using the relevanssi_hits_filter hook to exclude hits, both depending on language and on permission. For permission it works fine but not for language.
I am trying the find out the current selected language but it is always the default language of the site that is returned. I have tried a number of different ways that should return the current language, both WordPress build in functions as well as Polylang functions but with no luck. Always the default language is returned. Why?
I have made a printout of the language returned from these methods I have tried and inside SearchWP Live Ajax Search it is always the default one returned and when pressing enter to display the results the correct language is returned. When is the current language set?
Later on if pressing enter in the search form Relevanssi returns the matches in the current language.
/Erik
- The topic ‘Current language in relevanssi_hits_filter’ is closed to new replies.