Mass update user roles using wp cli

Change all users with a role of “subscriber” to “pmpro_role_2”

for USER_ID in $(wp user list --role=subscriber --field=ID); do wp user update $USER_ID --role=pmpro_role_2; done

List number of users for each role

wp eval 'print_r( count_users() );' 

Bill Erickson

Bill Erickson is the co-founder and lead developer at CultivateWP, a WordPress agency focusing on high performance sites for web publishers.

About Me
Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk