Last active
October 23, 2023 17:56
-
-
Save michael-sumner/ca94d49cef8506483f42692cbbf2aa29 to your computer and use it in GitHub Desktop.
WP-CLI - List all user roles with specific capability
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
capability="upload_files" | |
wp role list --fields=role --format=csv | tail -n +2 | while IFS= read -r role; do | |
if wp cap list "$role" | grep -q $capability; then | |
echo "$role" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment