• Hello,
    My site using 2 languages: Russian and English.
    When I search on Russian, everything is ok, i got results with url:
    site.com/search/query

    But when I use English version, I got results on Russian.

    I used lot of combinations and changed action form url for English version, but it didn’t work at all. Same Russian results.

    however, i can see English results with url like:
    site.com/en/search/query

    How should i change action url on my English form to get this work?

    https://wordpress.org/plugins/polylang/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Chouby

    (@chouby)

    Hi!

    Could you post your search form code here?

    Thread Starter Uberwebmaster

    (@uberwebmaster)

    <form role=”search” method=”get” action=”<?php echo home_url(); ?>”>

    Plugin Author Chouby

    (@chouby)

    Is this form in searchform.php?

    Thread Starter Uberwebmaster

    (@uberwebmaster)

    yeah,
    btw I am using Roots theme

    Plugin Author Chouby

    (@chouby)

    One possible issue is that the file searchform.php is not located in theme root directory. Thus the WordPress function get_search_form does not find it, so the get_search_form filter is not applied and finally Polylang cannot modify the action url.

    Thread Starter Uberwebmaster

    (@uberwebmaster)

    It is not. How can i fix this?
    What is correct action url for English version?

    Plugin Author Chouby

    (@chouby)

    In most cases, the home url in your language site.com/en/ will work. You can get it with pll_home_url() (check for its existence not to breakyour site when Polylang is de-activated, during upgrade for example). There is one case where pll_home_url() won’t work for the search form: if you are using a static front page and your homepage url is something site.com/en/home/

    Thread Starter Uberwebmaster

    (@uberwebmaster)

    I using static home page and it didn’t work,
    I already tried:
    site.com/en/
    site.com/en/search/

    with option “The front page url contains the language code instead of the page name or page id”

    site.com/home-en/

    nothing. It just show results in Russian.

    Plugin Author Chouby

    (@chouby)

    Did you try with a default theme and no other plugins activated?

    Thread Starter Uberwebmaster

    (@uberwebmaster)

    yes, just tested, it is working perfect.

    with form action “site.com/en/” I got English results.

    How can i fix this to work with Roots?

    Thread Starter Uberwebmaster

    (@uberwebmaster)

    Should I just add hidden field with language to my form?

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘I can't get my search to work.’ is closed to new replies.