From e8859072b9ce629a79c9ae4f3ea89a530457a25d Mon Sep 17 00:00:00 2001 From: Maarten Bruna <14947039+ictbeheer@users.noreply.github.com> Date: Fri, 14 Feb 2025 13:42:40 +0100 Subject: [PATCH] (fix): multisite config --- README.md | 8 ++++++++ src/Console/UserRolesCommand.php | 9 +-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a9ef6ab..d682314 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,14 @@ See [config](./config/user-roles.php) for all configuration options. 2. Run WP-CLI command to create roles: + Single site: + ```shell wp acorn roles:create ``` + + In a multisite: + + ```shell + wp site list --field=url | xargs -n1 -I % wp acorn roles:create --url=% + ``` diff --git a/src/Console/UserRolesCommand.php b/src/Console/UserRolesCommand.php index efabbad..fddacd6 100644 --- a/src/Console/UserRolesCommand.php +++ b/src/Console/UserRolesCommand.php @@ -33,13 +33,6 @@ public function handle(): void private function createRolesForSites(): void { - if (true === is_multisite()) { - foreach (get_sites(['fields' => 'ids']) as $siteId) { - switch_to_blog($siteId); - UserRoles::createRoles(); - } - } else { - UserRoles::createRoles(); - } + UserRoles::createRoles(); } }