tombroucke / acorn-wpml-livewire-fix
Prevents WPML from appending the language path to home_url() when Acorn sets the Laravel root URL, fixing broken Livewire asset and update URLs on translated pages.
Package info
github.com/tombroucke/acorn-wpml-livewire-fix
Type:wordpress-muplugin
pkg:composer/tombroucke/acorn-wpml-livewire-fix
Requires
- php: >=8.1
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Fixes broken Livewire asset and update URLs when using WPML (or TranslatePress) with Acorn v5.1+.
The problem
Acorn calls URL::forceRootUrl(home_url()) to set the Laravel root URL. WPML filters home_url() to append the current language prefix (e.g. /fr), causing:
livewire.jsto 404/livewire/updateto contain the language segment repeated 3× (e.g.https://example.com/fr/fr/fr/livewire/update)
Installation
1. Require the package:
composer require tombroucke/acorn-wpml-livewire-fix
2. Patch Acorn (until roots/acorn#570 is merged):
Add to composer.json:
"require": { "cweagans/composer-patches": "^2.0" }, "config": { "allow-plugins": { "cweagans/composer-patches": true } }, "extra": { "patches": { "roots/acorn": [ { "description": "Add do_action hooks around URL::forceRootUrl for WPML compatibility", "url": "https://patch-diff.githubusercontent.com/raw/roots/acorn/pull/570.patch" } ] } }
Then apply:
composer reinstall roots/acorn