# Issue with Multisite + Gutenberg

**URL:** https://discourse.roots.io/t/issue-with-multisite-gutenberg/15484
**Category:** trellis
**Created:** 2019-05-06T14:54:32Z
**Posts:** 25

## Post 1 by @mgargano — 2019-05-06T14:54:33Z

Running into a bunch of issues with Multisite and Gutenberg. I have the \*\*Multisite URL Fixer \*\*\* enabled in mu plugins

 ![21](https://discourse.roots.io/uploads/default/original/2X/2/26daa7df0d55a2ff47e1eba86ea29a23237fc921.png)

My subsite’s info is:

Site Address: [http://subsite.tst/](http://subsite.tst/)  
Site URL: [http://subsite.tst](http://subsite.tst)  
Home: [http://subsite.tst/wp](http://subsite.tst/wp)

I can’t seem to change the latter two, I believe it may be due to the MU plugin? When I try to save it reverts.

I read through the documentation multiple times and can’t seem to figure out what the issue is.

Note: Locally I am using apache (MAMP), but upstream using trellis, I’m having the same problems in both environments.

I hope to turn my learning experiences here into a guide so that others can learn from what I am doing…

---

## Post 2 by @mgargano — 2019-05-07T01:06:02Z

I created a brand new multisite using the following:

(NOTE: The repo I used for this site can be found @ [GitHub - matgargano/multisite](https://github.com/matgargano/multisite) …)

```
{
  "name": "roots/bedrock",
  "type": "project",
  "license": "MIT",
  "description": "WordPress boilerplate with modern development tools, easier configuration, and an improved folder structure",
  "homepage": "https://roots.io/bedrock/",
  "authors": [
    {
      "name": "Scott Walkinshaw",
      "email": "scott.walkinshaw@gmail.com",
      "homepage": "https://github.com/swalkinshaw"
    },
    {
      "name": "Ben Word",
      "email": "ben@benword.com",
      "homepage": "https://github.com/retlehs"
    }
  ],
  "keywords": [
    "bedrock", "composer", "roots", "wordpress", "wp", "wp-config"
  ],
  "support": {
    "issues": "https://github.com/roots/bedrock/issues",
    "forum": "https://discourse.roots.io/category/bedrock"
  },
  "config": {
    "preferred-install": "dist"
  },
  "repositories": [
    {
      "type": "composer",
      "url": "https://wpackagist.org"
    }
  ],
  "require": {
    "php": ">=7.0",
    "composer/installers": "^1.4",
    "vlucas/phpdotenv": "^3.0.0",
    "oscarotero/env": "^1.1.0",
    "roots/wordpress": "5.1.1",
    "roots/wp-config": "1.0.0",
    "roots/wp-password-bcrypt": "1.0.0",
    "roots/multisite-url-fixer": "^1.1"
  },
  "require-dev": {
    "squizlabs/php_codesniffer": "^3.0.2",
    "roave/security-advisories": "dev-master"
  },
  "extra": {
    "installer-paths": {
      "web/app/mu-plugins/{$name}/": ["type:wordpress-muplugin"],
      "web/app/plugins/{$name}/": ["type:wordpress-plugin"],
      "web/app/themes/{$name}/": ["type:wordpress-theme"]
    },
    "wordpress-install-dir": "web/wp"
  },
  "scripts": {
    "post-root-package-install": [
      "php -r \"copy('.env.example', '.env');\""
    ],
    "test": [
      "phpcs"
    ]
  }
}
```

and my `wordpress_sites.yml`

```
# Documentation: https://roots.io/trellis/docs/remote-server-setup/
# `wordpress_sites` options: https://roots.io/trellis/docs/wordpress-sites
# Define accompanying passwords/secrets in group_vars/production/vault.yml

wordpress_sites:
  manage.matgargano.com:
    site_hosts:
      - canonical: manage.matgargano.com

    local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
    repo: git@github.com:matgargano/multisite.git
    repo_subtree_path: site # relative path to your Bedrock/WP directory in your repo
    branch: master
    multisite:
      enabled: true
      subdomains: true
    ssl:
      enabled: true
      provider: letsencrypt
    cache:
      enabled: false
    env:
      domain_current_site: manage.matgargano.com
```

I left `tmp_multisite_constants.php` as it naturally is and added nothing (yet) to application.php

```
<?php
error_reporting(E_ALL & ~E_NOTICE);
define('MULTISITE', false);
define('SUBDOMAIN_INSTALL', false);
define('WPMU_PLUGIN_DIR', null);
define('WP_PLUGIN_DIR', null);
define('WP_USE_THEMES', false);
```

Provisioned using (`trellis provision production` … see [GitHub - roots/trellis-cli: A CLI to manage Trellis projects](https://github.com/roots/trellis-cli) for the tool i used), then commented out all the PHP in `tmp_multisite_constants.php`and added to `application.php` the following:

```
Config::define('WP_ALLOW_MULTISITE', true);
Config::define('MULTISITE', true);
Config::define('SUBDOMAIN_INSTALL', true); // Set to true if using subdomains
Config::define('DOMAIN_CURRENT_SITE', env('DOMAIN_CURRENT_SITE'));
Config::define('PATH_CURRENT_SITE', env('PATH_CURRENT_SITE') ?: '/');
Config::define('SITE_ID_CURRENT_SITE', env('SITE_ID_CURRENT_SITE') ?: 1);
Config::define('BLOG_ID_CURRENT_SITE', env('BLOG_ID_CURRENT_SITE') ?: 1);
Config::define('ADMIN_COOKIE_PATH', '/');
Config::define('COOKIE_DOMAIN', '');
Config::define('COOKIEPATH', '');
Config::define('SITECOOKIEPATH', '');
```

I then deployed using ` trellis deploy production manage.matgargano.com` … see [GitHub - roots/trellis-cli: A CLI to manage Trellis projects](https://github.com/roots/trellis-cli) for the tool i used

I setup the Multisite using WP CLI on the box `wp core multisite-install --title="site title" --admin_user="mat" --admin_password="gotcha" --admin_email="mat@me.com"`

I logged into the multisite network admin and I went to use the created `manage.matgargano.com`

When I go to `https://manage.matgargano.com/wp/wp-admin/post.php?post=2&action=edit` and try to update a post that has with Gutenberg I get a failure.

 ![17](https://discourse.roots.io/uploads/default/original/2X/f/f4e3bde80683c94259780340100b904366f28218.png)

However if I go to (note that I removed the /wp/) `https://manage.matgargano.com/wp-admin/post.php?post=2&action=edit` I can update the post without issue,

but if I try to customize with and without `/wp/` e.g., [https://manage.matgargano.com/wp/wp-admin/customize.php?return=%2Fwp%2Fwp-admin%2F](https://manage.matgargano.com/wp/wp-admin/customize.php?return=%2Fwp%2Fwp-admin%2F) _OR_ [https://manage.matgargano.com/wp-admin/customize.php?return=%2Fwp%2Fwp-admin%2F](https://manage.matgargano.com/wp-admin/customize.php?return=%2Fwp%2Fwp-admin%2F) … I get the following failure no matter what I try

```
You need a higher level of permission.
Sorry, you are not allowed to customize this site.
```

My questions boil down to –

- Am I doing _anything_ wrong? I’d like to stay as close to the _right_ way of using Trellis as possible…

- How can I get the customizer to work?

Note that here are my site settings for [manage.matgargano.com](http://manage.matgargano.com)

 ![49](https://discourse.roots.io/uploads/default/original/2X/2/2772f5620e06d2b3d8615e3687510683d9c1453c.png) ![46](https://discourse.roots.io/uploads/default/original/2X/4/4639b95c6329fcdff78765c8acd1ef6e2c7fd89a.png)

---

## Post 3 by @ryantbrenn — 2019-05-08T20:56:36Z

Hi, Im experiencing a similar issue. Have you found a solve?

---

## Post 4 by @mgargano — 2019-05-08T22:32:30Z

I have not – I can’t see how anyone can use the customizer on a multisite with trellis, though I am likely doing something wrong

---

## Post 5 by @swalkinshaw — 2019-05-09T03:34:02Z

Just to confirm, everything else with this install seems to work? It’s only an issue with Gutenberg posts?

And then the customizer issue is separate?

> Am I doing _anything_ wrong? I’d like to stay as close to the _right_ way of using Trellis as possible…

Doesn’t look like it but honestly I don’t have much experience with multisite on Trellis myself

> How can I get the customizer to work?

The most likely answer is there’s a bug somewhere… I’m not really much help though :frowning_face:

Can you check/post the contents of the generated `.env` file (on your VM/server in the web root).

---

## Post 6 by @mgargano — 2019-05-09T12:58:36Z

> [@swalkinshaw](#):
>
> Just to confirm, everything else with this install seems to work? It’s only an issue with Gutenberg posts?
> 
> And then the customizer issue is separate?

Yes, I’m sorry the two get a bit conflated here, but I did not want to flood with new topics. So, breaking down the two issues here, which are potentially related:

“Out of the box” using the install that I describe above, neither Gutenberg, nor the customizer work.

**Gutenberg:**

A temporary bandaid fix for Gutenberg is adding a 301 redirect for :

/wp/wp-admin/post.php\* **to** /wp-admin/post.php\*  
/wp/wp-admin/post-new.php\* **to** /wp-admin/post-new.php\*

**Customizer:**

I tried the same style fix for customizer, i.e. adding a redirect for the Customizer

/wp/wp-admin/customize.php?return=%2Fwp%2Fwp-admin%2Fedit.php **to** /wp-admin/customize.php?return=%2Fwp%2Fwp-admin%2Fedit.php

I get the same results as if I do not redirect

* * *

In my trellis built server here is my .env

```
AUTH_KEY='{redacted}'
AUTH_SALT='{redacted}'
DB_HOST='localhost'
DB_NAME='manage_matgargano_com_production'
DB_PASSWORD='{redacted}'
DB_USER='{redacted}'
DISABLE_WP_CRON='True'
DOMAIN_CURRENT_SITE='manage.matgargano.com'
LOGGED_IN_KEY='{redacted}'
LOGGED_IN_SALT='{redacted}'
NONCE_KEY='{redacted}'
NONCE_SALT='{redacted}'
SECURE_AUTH_KEY='{redacted}'
SECURE_AUTH_SALT='{redacted}'
WP_ENV='production'
WP_HOME='https://manage.matgargano.com'
WP_SITEURL='https://manage.matgargano.com/wp'
```

–

You can recreate my issue using the repo I am using [GitHub - matgargano/multisite](https://github.com/matgargano/multisite)

or I can easily give you access to everything, feel free to message me on slack and then whatever the solution is that we get to I will summarize for the rest of the community.

---

## Post 7 by @mgargano — 2019-05-14T12:20:18Z

any thoughts here? I may have to abandon MU for client sites if this is an issue. This would really neatly allow me to host multiple client sites on the same server.

---

## Post 8 by @ben — 2019-05-14T14:32:02Z

There’s a 100% chance this can be fixed.

I currently don’t have the free time to look into this myself.

---

## Post 9 by @knowler — 2019-05-15T18:37:02Z

@mgargano I think I’m experiencing this issue as well. I’ll report back with my findings.

---

## Post 10 by @mgargano — 2019-05-15T19:28:58Z

@knowler :+1: I am at a loss at this point.

---

## Post 11 by @knowler — 2019-05-18T19:49:11Z

The solution seems to be as simple as setting the following in `config/application.php`:

```
Config::define('COOKIE_DOMAIN', $_SERVER['HTTP_HOST']);
```

For me the issues had to do with the nonce cookie not being able to verify since the sub-site domain was different than the cookie domain. I was having difficulty with Gutenberg and a multisite using custom domains for sub-sites. So I don’t know if this will work for your issue.

---

## Post 12 by @mgargano — 2019-05-18T21:33:57Z

This does **not** work in my configuration.

Can you test if this works for your Customizer?

---

## Post 13 by @mgargano — 2019-05-18T21:40:52Z

> [@knowler](#):
>
> Config:define(‘COOKIE\_DOMAIN’, $\_SERVER[‘HTTP\_HOST’]);

Also can you post your application.php

mine is: [config.php · GitHub](https://gist.github.com/matgargano/9813288f59d803ec57d5a767dd50419c)

---

## Post 14 by @knowler — 2019-05-18T22:27:49Z

Customizer seems to work fine. Here’s my Bedrock config:

[https://gist.github.com/knowler/3727742a753cdd34750895c8303c259c](https://gist.github.com/knowler/3727742a753cdd34750895c8303c259c)

---

## Post 15 by @mgargano — 2019-05-18T23:03:00Z

OK Few things —

First and foremost : [https://gist.github.com/knowler/3727742a753cdd34750895c8303c259c#file-application-php-L102](https://gist.github.com/knowler/3727742a753cdd34750895c8303c259c#file-application-php-L102) any issue with the single colon? I’ve literally never seen that in PHP

Do you have all subdirectories? subdomains? Do you have any TLD mapped domains?

Thanks for the assistance so far…

---

## Post 16 by @mgargano — 2019-05-19T01:22:46Z

Ok some more things…

If I use a subdomain, e.g. [manage.matgargano.com](http://manage.matgargano.com) and [multisite.matgargano.com](http://multisite.matgargano.com) i am able to do everything without any issue.

if i map to a separate domain ([foobar.com](http://foobar.com)) that’s when i have the issue… still digging further…

---

## Post 17 by @knowler — 2019-05-19T02:00:14Z

My bad that’s a syntax error.

I have mapped domains with a subdomain setup.

---

## Post 18 by @mgargano — 2019-05-20T21:34:52Z

Have you tried mapping TLDs and not subdomains? If not- can you? I can supply the domain if you need one.

Something isn’t adding up… likely something I’m doing. Would you want to walk through the whole process with trellis and bedrock with me to see where I’m possibly doing something wrong.

-Mat

---

## Post 19 by @mgargano — 2019-06-04T13:56:53Z

@knowler any update here?

---

## Post 20 by @knowler — 2019-06-04T17:03:23Z

See this:

> [@Not Sure How To Get Multisite Functional in Dev Environment](https://discourse.roots.io/t/not-sure-how-to-get-multisite-functional-in-dev-environment/15701/2):
>
> Ok, so from the sounds of it, you want to host a Bedrock multisite network where the domains are all unique (not subdomains or subdirectories). For multisite installs WordPress gives you two options, subdomains or subdirectories. In order to do domain mapping — i.e. using custom domains for each site — we need to go with the subdomain option. This means we just need one Bedrock install. When you initially create a site in the network admin, you will need to create the domain as: \<domain-i-want\>.\<…

---

## Post 21 by @mgargano — 2019-06-04T20:50:57Z

I can’t believe that was it !?

seems to work, need to do more testing

---

## Post 22 by @mgargano — 2019-06-04T21:21:56Z

OK, so I tried just wholesale replacing my application.php with your application.php

I still have the same issue

After Config::apply() I error\_log out COOKIE\_DOMAIN and it is in fact the right domain (the current domain I am on).

Any idea how to further troubleshoot?

---

## Post 23 by @mgargano — 2019-06-04T21:37:52Z

one other thing to note is that wp\_blogs has [mydomain.com](http://mydomain.com) (the same domain set to COOKIE\_DOMAIN above) and wp\_3\_options has siteurl = [mydomain.com](http://mydomain.com) and home = [mydomain.com/wp](http://mydomain.com/wp) (i even tried changing home to = [mydomain.com](http://mydomain.com) (without /wp) and still didnt work

---

## Post 24 by @mgargano — 2019-06-06T15:55:04Z

@knowler where is the nonce check happening? I can troubleshoot backwards from there.

---

## Post 25 by @system — 2019-06-17T14:57:15Z

This topic was automatically closed after 42 days. New replies are no longer allowed.
