Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › The search bar does not work in translations with GTranslate
- This topic has 8 replies, 2 voices, and was last updated 11 months, 1 week ago by
Ernest Marcinko.
-
AuthorPosts
-
May 29, 2025 at 12:04 pm #54192
mirko_mtgX
ParticipantHello, we have a search bar in the header that works perfectly in the English version, but in the other languages it just keeps loading and no results appear. We use GTranslate for translations.
I am attaching two screenshots so you can see what I mean.
Can you provide a solution for this?
Thanks-
This topic was modified 1 year ago by
mirko_mtgX.
May 29, 2025 at 12:22 pm #54196Ernest Marcinko
KeymasterHi,
Try this custom code snippet:
add_filter('asp/ajax/headers/content_type', function($content_type) { return 'text/plain'; }, 99, 1);Try adding this code via the Code Snippets plugin or to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.
However the current implementation was recommended by GTranslate developers and should work as-is, so they probably changed something somewhere, as I’m seeing added HTML closing and opening tags littered into the response body – as well as some missing strings.
May 29, 2025 at 1:00 pm #54197mirko_mtgX
ParticipantThank you for your quick response. It is working now, but the results are shown in English, which is the original language. For example, if I am in Spanish and search for any word, the results are the English pages. Is there a way to fix this?
ThanksMay 29, 2025 at 1:03 pm #54198Ernest Marcinko
KeymasterGtranslate should automatically translate that, as it’s a reverse proxy. You may have to ask their support about that, maybe there is an option you need to enable or something similar.
I have spoken with them some time ago, and all I know is that it automatically translates everything. We were trying to figure out if there was a way to search the translated content, but apparently that’s not possible to access in any way by any plugin.
May 29, 2025 at 1:07 pm #54199mirko_mtgX
ParticipantOk, thanks for your help. I’ll ask them and see if they can give me a solution.
Best regards.June 5, 2025 at 8:37 am #54292mirko_mtgX
ParticipantYou cannot access this content.
June 5, 2025 at 8:48 am #54294Ernest Marcinko
KeymasterI honestly don’t know what they are reffering to either here. They want you to add something somewhere, but I don’t know what or where, I don’t understand unfortunately either. Is there no interface on the gTranslate settings to add like keyword exceptions or anything like that?
We have spoken about 2-3 months ago with them, they suggested a modification which I have implemented already (changin the response to HTML). Then it was working just fine. The change is actually within the search, it was integrated to it. Now it does not work again with the change in place, so I guess there might have been a change on their side too.
June 24, 2025 at 6:47 pm #54503mirko_mtgX
ParticipantYou cannot access this content.
June 25, 2025 at 11:22 am #54507Ernest Marcinko
KeymasterThat code look okay to me, it doesn’t work?
The hook seems to be correct as far as I can tell. -
This topic was modified 1 year ago by
-
AuthorPosts
- You must be logged in to reply to this topic.