I have a multisite setup with some 14 woocommerce sites.

site_id | domain
1       | local.mainsite.com
2       | local.subsite-2.com
3       | local.subsite-3.com
4       | local.subsite-4.com

I want to retrieve the blogname of subsite 4 (local.subsite-4.com which exists as a working site, and is also present in wp_blogs).

So, I do: wp option get blogname --url=local.subsite-4.com.

It returns the blogname of site 1 (local.mainsite.com, not the subsite set in the --url parameter).

Can anyone reproduce this or have any suggestion on what I am doing wrong here?

I'm using the latest wordpress core.

OS: Darwin 20.5.0 Darwin Kernel Version 20.5.0: Sat May  8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64
Shell:  /bin/zsh
PHP binary: /usr/local/Cellar/[email protected]/7.4.23/bin/php
PHP version:    7.4.23
php.ini used:   /usr/local/etc/php/7.4/php.ini
MySQL binary:   /usr/local/bin/mysql
MySQL version:  mysql  Ver 15.1 Distrib 10.6.4-MariaDB, for osx10.16 (x86_64) using readline 5.1
WP-CLI root dir:    phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:  phar://wp-cli.phar/vendor
WP_CLI phar path:   /Users/jurgen/Sites/local.gasveerwinkel.nl/www
WP-CLI packages dir:    /Users/jurgen/.wp-cli/packages/
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.5.0
  • should globname be blogname? I could not reproduce this locally
    – Tom J Nowell
    Sep 15, 2021 at 16:59
  • If it returns the blogname of the main site, then it's possible that you made a typo in the --url value.. like --url=local.subste-4.com (note it's missing the letter "i")? And I actually reproduced the issue by deliberately using a non-existent site. Have you tried using a full URL like http://local.subsite-4.com ?
    – Sally CJ
    Sep 15, 2021 at 17:17
  • @SallyCJ I copied the domain directly from the database table wp_blogs. Tried the same with one of the blogs listed with wp site list. I've tried the full url, also the domain without protocol, but with no effect Sep 15, 2021 at 17:33
  • So all the other sites but the main one, gave you the main site's blogname? That's strange 🤔 and shouldn't happen, so maybe you can try deactivating plugins and/or switching to a default theme? Just in case..
    – Sally CJ
    Sep 15, 2021 at 18:09
  • @SallyCJ All sites return the main site's blogname. I am now doing some tests with disabling plugins and themes, that takes some time with a multisite setup with 14 sites Sep 15, 2021 at 20:55


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.