Hi @blue-liquid-designs ,
hope you’re fine? Sorry for the issue you’re facing. I take a look and go back with a fix.
Regards
Hi @blue-liquid-designs ,
i’ve identify the issue. On weglot we’ve have a method to check if we need redirection or not : check_need_to_redirect at line 200 wp-content/plugins/weglot/src/actions/front/class-translate-page-weglot.php
on this method we check if the request if an ajax call to prevent redirection.
On your case it seems that your ajax call is not detected by our code. To check that we use the wp_doing_ajax provide by wp. It seems that you don’t use admin-ajax.php to make you’re XHR. Can you confirm that and do you have reason to don’t pass through admin-ajax.php ? There is a way to change it on your side ?
Another way is to set/add the X-Requested-With to ‘XMLHttpRequest’ and on our side we’ll can check if this header exist : https://www.google.com/search?q=x-requested-with+xmlhttprequest&rlz=1C5CHFA_enFR941FR941&ei=JZdWY_erH8-ElwSnr4CoCQ&oq=x-requested-with+xmlhttprequest+&gs_lcp=Cgxnd3Mtd2l6LXNlcnAQARgIMgcIABCABBATMgcIABCABBATMgcIABCABBATMgcIABCABBATMggIABAWEB4QEzIICAAQFhAeEBMyCAgAEBYQHhATMggIABAWEB4QEzIICAAQFhAeEBMyCAgAEBYQHhATOgoIABBHENYEELADOgcIABCwAxBDSgQITRgBSgQIQRgASgQIRhgAUNEBWNEBYPctaAFwAXgAgAFaiAFakgEBMZgBAKABAcgBCcABAQ&sclient=gws-wiz-serp
Regards
Thanks for the information.
To clarify, I don’t represent Gravity Forms and I cannot change the way file uploads are handled in Gravity Forms. I’m just reporting the compatibility issue.
Looking at the redirect code in Weglot, my suggestion would be to add a bypass filter hook that could be used by plugin developers to skip the redirect. This would allow any plugin that does things a little differently to control when to skip this process. It would save you from adding one-off exceptions directly to the redirect logic every time a plugin has a compatibility problem with this feature.
If you wanted to fix the bug directly in Weglot, you could then have a separate Gravity Forms class that’ll detect an upload request and use the filter to bypass.
-
This reply was modified 3 years, 7 months ago by
Jake Jackson.
Hi @blue-liquid-designs ,
sorry for the mistake ^^. About your issue I reach it to my CTO. In fact, we already have a filter like this : https://developers.weglot.com/wordpress/use-cases/auto-switch-only-for-homepage
This filter allow you to have redirect only on the homepage, it’s a solution but not the better.
We think that the best solution is to make “good” ajax call we can detect so it will be avoid by our code but you’re right some people need another solution to avoid the auto-redirect so we add a new filter :
add_filter( 'weglot_autoredirect_skip', '__return_true' );
you can use it to skip the autoredirect but like I say on my previous post, I don’t have solution to detect the upload request on gfrom. You ay use the filter with a hook if they have one
You can find a patch version of the plugin here : https://we.tl/t-4QL46nDgNx
The new filter would be add on our next release (3.9)
DOn’t hesitate if you need more information or have other questions
Thanks for your help
Regards