> For the complete documentation index, see [llms.txt](https://developers.weglot.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.weglot.com/cms/wordpress/helpers-functions-1/weglot_autoredirect_js.md).

# weglot\_autoredirect\_js

Return `true` to perform the auto-redirect via the front-end JS library instead of server-side. Useful behind aggressive caching that interferes with server redirects.

```php
add_filter( 'weglot_autoredirect_js', '__return_true' );
```

{% hint style="warning" %}
On its own this filter does nothing: the JS library only loads when `weglot_translate_dynamics` returns `true` and the page is allowed by `weglot_allowed_urls` (return `'all'` for every page). See [Autoswitch System: Server-Side and Client-Side implementation](/cms/wordpress/autoswitch-system-server-side-and-client-side-implementation.md) for the full snippet.
{% endhint %}
