0

Working on my first decoupled site. Backend is handled by WordPress and lives on the subdomain admin.mydomain.com and the frontend lives at mydomain.com.

The first issue I saw with the headless approach, was that all permalinks referred to admin.mydomain.com. I wanted to change that so that the backend referenced to my frontend.

So I changed my config from:
WP_HOME='http://admin.mydomain.test'
WP_SITEURL='http://admin.domain.test/wp'

to:
WP_HOME='http://mydomain.test'
WP_SITEURL='http://admin.domain.test/wp'

which sorted my issue with the permalinks, but now I'm getting console errors on the WP dashboard because the plugins can't find the resources they need, for example ACF:

index.php:63 GET http://mydomain.test/app/plugins/advanced-custom-fields-pro/assets/css/acf-global.css?ver=5.8.4 net::ERR_NAME_NOT_RESOLVED

What would be the proper course of action to fix this?

0

My quick and dirty fix looks like this (please note that I use Roots Bedrock, so it differs from a vanilla WP install).

  1. In .env add this line WP_HOME_ADMIN='http://admin.mydomain.test'

  2. In application.php add this line, preferable just after where WP_HOME is defined: Config::define('WP_HOME_ADMIN', env('WP_HOME_ADMIN'));

  3. Somewhere after where CONTENT_DIR is defined, add this line: Config::define('WP_PLUGIN_URL', Config::get('WP_HOME_ADMIN') . Config::get('CONTENT_DIR') .'/plugins');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.