[SOLVED] Search in specific Polylang language content


Just sharing a small fix I created, to get the Roots search widget to play nicely with Polylang languages. The fix is pretty specific for my setup (soil-nice-search: off, polylang setting default language not in url: on, polylang languages as subdirectories: on), but maybe I can help someone else too.

The problem was: All searches were being done in the root, ignoring Polylang language subdirectories. Apparently Polylang needs the searchform.php template to be in the root to modify the form action url. Since Roots is setup differently that was causing issues.

I’ve posted the modified searchform.php at https://gist.github.com/bramchi/d0767c32a772550486ea

Have a nice day!

Thank you very much for this post! Solved my problem too with just a small variation that someone may be looking too. In my theme ‘Kallyas’, just including that small Polylang snippet on beginning of the searchform.php file was sufficient. Thank you again!