{"id":28619622,"url":"https://github.com/wp-cli/role-command","last_synced_at":"2025-06-12T04:40:48.221Z","repository":{"id":45041063,"uuid":"88057409","full_name":"wp-cli/role-command","owner":"wp-cli","description":"Adds, removes, lists, and resets roles and capabilities.","archived":false,"fork":false,"pushed_at":"2025-05-07T12:03:43.000Z","size":8649,"stargazers_count":6,"open_issues_count":1,"forks_count":11,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-05-10T15:16:27.244Z","etag":null,"topics":["access","cli","hacktoberfest","role","security","wordpress","wp-cli","wp-cli-package"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wp-cli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-12T13:52:42.000Z","updated_at":"2025-04-21T23:05:39.000Z","dependencies_parsed_at":"2025-01-30T11:38:22.986Z","dependency_job_id":null,"html_url":"https://github.com/wp-cli/role-command","commit_stats":{"total_commits":480,"total_committers":45,"mean_commits":"10.666666666666666","dds":0.7229166666666667,"last_synced_commit":"f586e09fe36aa15a213677e0bed3cd0f5e70613b"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/wp-cli/role-command","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Frole-command","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Frole-command/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Frole-command/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Frole-command/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wp-cli","download_url":"https://codeload.github.com/wp-cli/role-command/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Frole-command/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259400433,"owners_count":22851809,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["access","cli","hacktoberfest","role","security","wordpress","wp-cli","wp-cli-package"],"created_at":"2025-06-12T04:40:46.505Z","updated_at":"2025-06-12T04:40:48.211Z","avatar_url":"https://github.com/wp-cli.png","language":"PHP","readme":"wp-cli/role-command\n===================\n\nAdds, removes, lists, and resets roles and capabilities.\n\n[![Testing](https://github.com/wp-cli/role-command/actions/workflows/testing.yml/badge.svg)](https://github.com/wp-cli/role-command/actions/workflows/testing.yml)\n\nQuick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing) | [Support](#support)\n\n## Using\n\nThis package implements the following commands:\n\n### wp role\n\nManages user roles, including creating new roles and resetting to defaults.\n\n~~~\nwp role\n~~~\n\nSee references for [Roles and Capabilities](https://codex.wordpress.org/Roles_and_Capabilities) and [WP User class](https://codex.wordpress.org/Class_Reference/WP_User).\n\n**EXAMPLES**\n\n    # List roles.\n    $ wp role list --fields=role --format=csv\n    role\n    administrator\n    editor\n    author\n    contributor\n    subscriber\n\n    # Check to see if a role exists.\n    $ wp role exists editor\n    Success: Role with ID 'editor' exists.\n\n    # Create a new role.\n    $ wp role create approver Approver\n    Success: Role with key 'approver' created.\n\n    # Delete an existing role.\n    $ wp role delete approver\n    Success: Role with key 'approver' deleted.\n\n    # Reset existing roles to their default capabilities.\n    $ wp role reset administrator author contributor\n    Success: Reset 3/3 roles.\n\n\n\n### wp role create\n\nCreates a new role.\n\n~~~\nwp role create \u003crole-key\u003e \u003crole-name\u003e [--clone=\u003crole\u003e]\n~~~\n\n**OPTIONS**\n\n\t\u003crole-key\u003e\n\t\tThe internal name of the role.\n\n\t\u003crole-name\u003e\n\t\tThe publicly visible name of the role.\n\n\t[--clone=\u003crole\u003e]\n\t\tClone capabilities from an existing role.\n\n**EXAMPLES**\n\n    # Create role for Approver.\n    $ wp role create approver Approver\n    Success: Role with key 'approver' created.\n\n    # Create role for Product Administrator.\n    $ wp role create productadmin \"Product Administrator\"\n    Success: Role with key 'productadmin' created.\n\n\n\n### wp role delete\n\nDeletes an existing role.\n\n~~~\nwp role delete \u003crole-key\u003e\n~~~\n\n**OPTIONS**\n\n\t\u003crole-key\u003e\n\t\tThe internal name of the role.\n\n**EXAMPLES**\n\n    # Delete approver role.\n    $ wp role delete approver\n    Success: Role with key 'approver' deleted.\n\n    # Delete productadmin role.\n    $ wp role delete productadmin\n    Success: Role with key 'productadmin' deleted.\n\n\n\n### wp role exists\n\nChecks if a role exists.\n\n~~~\nwp role exists \u003crole-key\u003e\n~~~\n\nExits with return code 0 if the role exists, 1 if it does not.\n\n**OPTIONS**\n\n\t\u003crole-key\u003e\n\t\tThe internal name of the role.\n\n**EXAMPLES**\n\n    # Check if a role exists.\n    $ wp role exists editor\n    Success: Role with ID 'editor' exists.\n\n\n\n### wp role list\n\nLists all roles.\n\n~~~\nwp role list [--fields=\u003cfields\u003e] [--field=\u003cfield\u003e] [--format=\u003cformat\u003e]\n~~~\n\n**OPTIONS**\n\n\t[--fields=\u003cfields\u003e]\n\t\tLimit the output to specific object fields.\n\n\t[--field=\u003cfield\u003e]\n\t\tPrints the value of a single field.\n\n\t[--format=\u003cformat\u003e]\n\t\tRender output in a particular format.\n\t\t---\n\t\tdefault: table\n\t\toptions:\n\t\t  - table\n\t\t  - csv\n\t\t  - json\n\t\t  - count\n\t\t  - yaml\n\t\t---\n\n**AVAILABLE FIELDS**\n\nThese fields will be displayed by default for each role:\n\n* name\n* role\n\nThere are no optional fields.\n\n**EXAMPLES**\n\n    # List roles.\n    $ wp role list --fields=role --format=csv\n    role\n    administrator\n    editor\n    author\n    contributor\n    subscriber\n\n\n\n### wp role reset\n\nResets any default role to default capabilities.\n\n~~~\nwp role reset [\u003crole-key\u003e...] [--all]\n~~~\n\nUses WordPress' `populate_roles()` function to put one or more\nroles back into the state they were at in the a fresh\nWordPress install. Removes any capabilities that were added,\nand restores any capabilities that were removed. Custom roles\nare not affected.\n\n**OPTIONS**\n\n\t[\u003crole-key\u003e...]\n\t\tThe internal name of one or more roles to reset.\n\n\t[--all]\n\t\tIf set, all default roles will be reset.\n\n**EXAMPLES**\n\n    # Reset three roles.\n    $ wp role reset administrator author contributor\n    Restored 1 capability to and removed 0 capabilities from 'administrator' role.\n    No changes necessary for 'author' role.\n    No changes necessary for 'contributor' role.\n    Success: 1 of 3 roles reset.\n\n    # Reset a custom role.\n    $ wp role reset custom_role\n    Custom role 'custom_role' not affected.\n    Error: Must specify a default role to reset.\n\n    # Reset all default roles.\n    $ wp role reset --all\n    Success: All default roles reset.\n\n\n\n### wp cap\n\nAdds, removes, and lists capabilities of a user role.\n\n~~~\nwp cap\n~~~\n\nSee references for [Roles and Capabilities](https://codex.wordpress.org/Roles_and_Capabilities) and [WP User class](https://codex.wordpress.org/Class_Reference/WP_User).\n\n**EXAMPLES**\n\n    # Add 'spectate' capability to 'author' role.\n    $ wp cap add 'author' 'spectate'\n    Success: Added 1 capability to 'author' role.\n\n    # Add all caps from 'editor' role to 'author' role.\n    $ wp cap list 'editor' | xargs wp cap add 'author'\n    Success: Added 24 capabilities to 'author' role.\n\n    # Remove all caps from 'editor' role that also appear in 'author' role.\n    $ wp cap list 'author' | xargs wp cap remove 'editor'\n    Success: Removed 34 capabilities from 'editor' role.\n\n\n\n### wp cap add\n\nAdds capabilities to a given role.\n\n~~~\nwp cap add \u003crole\u003e \u003ccap\u003e... [--grant]\n~~~\n\n**OPTIONS**\n\n\t\u003crole\u003e\n\t\tKey for the role.\n\n\t\u003ccap\u003e...\n\t\tOne or more capabilities to add.\n\n\t[--grant]\n\t\tAdds the capability as an explicit boolean value, instead of implicitly defaulting to `true`.\n\t\t---\n\t\tdefault: true\n\t\toptions:\n\t\t  - true\n\t\t  - false\n\t\t---\n\n**EXAMPLES**\n\n    # Add 'spectate' capability to 'author' role.\n    $ wp cap add author spectate\n    Success: Added 1 capability to 'author' role.\n\n\n\n### wp cap list\n\nLists capabilities for a given role.\n\n~~~\nwp cap list \u003crole\u003e [--format=\u003cformat\u003e] [--show-grant]\n~~~\n\n**OPTIONS**\n\n\t\u003crole\u003e\n\t\tKey for the role.\n\n\t[--format=\u003cformat\u003e]\n\t\tRender output in a particular format.\n\t\t---\n\t\tdefault: list\n\t\toptions:\n\t\t  - list\n\t\t  - table\n\t\t  - csv\n\t\t  - json\n\t\t  - count\n\t\t  - yaml\n\t\t---\n\n\t[--show-grant]\n\t\tDisplay all capabilities defined for a role including grant.\n\t\t---\n\t\tdefault: false\n\t\t---\n\n**EXAMPLES**\n\n    # Display alphabetical list of Contributor capabilities.\n    $ wp cap list 'contributor' | sort\n    delete_posts\n    edit_posts\n    level_0\n    level_1\n    read\n\n\n\n### wp cap remove\n\nRemoves capabilities from a given role.\n\n~~~\nwp cap remove \u003crole\u003e \u003ccap\u003e...\n~~~\n\n**OPTIONS**\n\n\t\u003crole\u003e\n\t\tKey for the role.\n\n\t\u003ccap\u003e...\n\t\tOne or more capabilities to remove.\n\n**EXAMPLES**\n\n    # Remove 'spectate' capability from 'author' role.\n    $ wp cap remove author spectate\n    Success: Removed 1 capability from 'author' role.\n\n## Installing\n\nThis package is included with WP-CLI itself, no additional installation necessary.\n\nTo install the latest version of this package over what's included in WP-CLI, run:\n\n    wp package install git@github.com:wp-cli/role-command.git\n\n## Contributing\n\nWe appreciate you taking the initiative to contribute to this project.\n\nContributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.\n\nFor a more thorough introduction, [check out WP-CLI's guide to contributing](https://make.wordpress.org/cli/handbook/contributing/). This package follows those policy and guidelines.\n\n### Reporting a bug\n\nThink you’ve found a bug? We’d love for you to help us get it fixed.\n\nBefore you create a new issue, you should [search existing issues](https://github.com/wp-cli/role-command/issues?q=label%3Abug%20) to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version.\n\nOnce you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please [create a new issue](https://github.com/wp-cli/role-command/issues/new). Include as much detail as you can, and clear steps to reproduce if possible. For more guidance, [review our bug report documentation](https://make.wordpress.org/cli/handbook/bug-reports/).\n\n### Creating a pull request\n\nWant to contribute a new feature? Please first [open a new issue](https://github.com/wp-cli/role-command/issues/new) to discuss whether the feature is a good fit for the project.\n\nOnce you've decided to commit the time to seeing your pull request through, [please follow our guidelines for creating a pull request](https://make.wordpress.org/cli/handbook/pull-requests/) to make sure it's a pleasant experience. See \"[Setting up](https://make.wordpress.org/cli/handbook/pull-requests/#setting-up)\" for details specific to working on this package locally.\n\n## Support\n\nGitHub issues aren't for general support questions, but there are other venues you can try: https://wp-cli.org/#support\n\n\n*This README.md is generated dynamically from the project's codebase using `wp scaffold package-readme` ([doc](https://github.com/wp-cli/scaffold-package-command#wp-scaffold-package-readme)). To suggest changes, please submit a pull request against the corresponding part of the codebase.*\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-cli%2Frole-command","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwp-cli%2Frole-command","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-cli%2Frole-command/lists"}