Skip to content

Instantly share code, notes, and snippets.

Last active January 2, 2020 03:41
What would you like to do?

WP-CLI Commands

Change WordPress Multisite Roles Using WP-CLI

Changing super-admin role (multisite):

> wp super-admin list

> wp super-admin remove EMAIL_ADDRESS

> wp super-admin add EMAIL_ADDRESS

Remove a user's access to a site dashboard (multisite):

> wp user list --role=administrator

> wp user remove-role USER_ID --url=NETWORK_SITE_DOMAIN/SITE_NAME

Change an existing user's access on a site to subscriber (multisite):

> wp user set-role USER_ID subscriber --url=NETWORK_SITE_DOMAIN/SITE_NAME

Change an existing user's login username

> wp db query 'SELECT ID, user_login FROM wp_users WHERE ID = ...'
> wp db query 'UPDATE wp_users SET user_login = "..." WHERE ID = ...;'


Give an editor access to the Yoast SEO menu and advanced options

wp cap add editor wpseo_manage_options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment