• Resolved Paul Jones

    (@pauljonesdesign)


    Do you need Polylang Pro for the default WordPress search functionality to work on a second language?

    Currently it redirects to the default language after searching for something on a second language.

    For example I click the search icon in the header menu and a search works at:

    example.com/default-language

    Search redirects back to main language and main page at:

    example.com/es/second-language

    Has anyone come across this and managed to solve it or know of a fix?

    Thank you,

    Paul

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

    (@chouby)

    Hello,

    This works out of the box with Polylang. There is nothing more in Polylang Pro related to this feature. But the search form as to follow best practices allow Polylang to filter it. See also: https://polylang.pro/always-use-get_search_form-to-create-search-forms/

    Thread Starter Paul Jones

    (@pauljonesdesign)

    Hello,

    Thank you for your quick response and linking me to this article.

    I’m also working with GeneratePress support to resolve this issue and can reply to this thread with the fix once it’s resolved.

    Best regards,

    Paul

    Thread Starter Paul Jones

    (@pauljonesdesign)

    Hi @chouby , that helped a lot, thank you!

    For GeneratePress users who are having trouble getting Polylang to work with the new GeneratePress search modal there two ways you can get the search modal to work.

    Cred it to Ying from GeneratePress support, the following code adds WP’s default search form to the search modal::

    function custom_generate_do_search_fields() {
    	get_search_form();
    }
    
    add_action('wp', function() {
    	remove_action( 'generate_inside_search_modal', 'generate_do_search_fields' );
    });
    add_action( 'generate_inside_search_modal', 'custom_generate_do_search_fields' );

    Or

    Create a block element, set the element type to Search modal, then you can add a WP search form block to the element, set the location to?entire site.

    Thanks again!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Search Functionality not Working with Polylang 2nd Language’ is closed to new replies.