PHPackages                             wp-cli/ability-command - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. wp-cli/ability-command

ActiveWp-cli-package[CLI &amp; Console](/categories/cli)

wp-cli/ability-command
======================

Lists, inspects, and executes abilities registered via the WordPress Abilities API.

v1.0.1(2w ago)2171.4k↑30.5%MITPHPCI passing

Since Mar 16Pushed 2w agoCompare

[ Source](https://github.com/wp-cli/ability-command)[ Packagist](https://packagist.org/packages/wp-cli/ability-command)[ Docs](https://github.com/wp-cli/ability-command)[ RSS](/packages/wp-cli-ability-command/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (4)Versions (5)Used By (0)

wp-cli/ability-command
======================

[](#wp-cliability-command)

Lists, inspects, and executes abilities registered via the WordPress Abilities API.

[![Testing](https://github.com/wp-cli/ability-command/actions/workflows/testing.yml/badge.svg)](https://github.com/wp-cli/ability-command/actions/workflows/testing.yml) [![Code Coverage](https://camo.githubusercontent.com/e3400a6f3c98cf71529360e42a2fc34e26b7eb1ab80f5661eddd7dbdfe84f9e0/68747470733a2f2f636f6465636f762e696f2f67682f77702d636c692f6162696c6974792d636f6d6d616e642f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/wp-cli/ability-command/tree/main)

Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing) | [Support](#support)

Using
-----

[](#using)

This package implements the following commands:

### wp ability

[](#wp-ability)

Lists, inspects, and executes abilities registered via the WordPress Abilities API.

```
wp ability

```

The Abilities API, introduced in WordPress 6.9, provides a standardized way to register and discover distinct units of functionality within a WordPress site.

**EXAMPLES**

```
# List all registered abilities.
$ wp ability list
+---------------------------+----------------------+----------+------------------------------------------+
| name                      | label                | category | description                              |
+---------------------------+----------------------+----------+------------------------------------------+
| core/get-site-info        | Get Site Information | site     | Returns site information configured i... |
| core/get-user-info        | Get User Information | user     | Returns basic profile details for the... |
| core/get-environment-info | Get Environment Info | site     | Returns core details about the site's... |
+---------------------------+----------------------+----------+------------------------------------------+

# Get details of a specific ability.
$ wp ability get core/get-site-info --fields=name,label,category,readonly,show_in_rest
+---------------+----------------------+
| Field         | Value                |
+---------------+----------------------+
| name          | core/get-site-info   |
| label         | Get Site Information |
| category      | site                 |
| readonly      | 1                    |
| show_in_rest  | 1                    |
+---------------+----------------------+

# Execute an ability with JSON input (required for array values).
$ wp ability run core/get-site-info --input='{"fields":["name","version"]}' --user=admin
{
    "name": "Test Blog",
    "version": "6.9"
}

# Check if an ability exists.
$ wp ability exists core/get-site-info
$ echo $?
0

# Check if user can run an ability.
$ wp ability can-run core/get-site-info
$ echo $?
0

# Validate input before execution.
$ wp ability validate core/get-site-info --input='{"fields":["name","version"]}'
Success: Input is valid.

```

### wp ability list

[](#wp-ability-list)

Lists all registered abilities.

```
wp ability list [--category=] [--namespace=] [--show-in-rest=] [--field=] [--fields=] [--format=]

```

**OPTIONS**

```
[--category=]
	Filter abilities by category slug.

[--namespace=]
	Filter abilities by namespace prefix (e.g., 'core' for 'core/*' abilities).

[--show-in-rest=]
	Filter abilities by REST API exposure.

[--field=]
	Prints the value of a single field for each ability.

[--fields=]
	Limit the output to specific ability fields.

[--format=]
	Render output in a particular format.
	---
	default: table
	options:
	  - table
	  - csv
	  - json
	  - yaml
	  - count
	  - ids
	---

```

**AVAILABLE FIELDS**

These fields will be displayed by default for each ability:

- name
- label
- category
- description

These fields are optionally available:

- readonly
- destructive
- idempotent
- show\_in\_rest

**EXAMPLES**

```
# List all abilities.
$ wp ability list
+---------------------------+----------------------+----------+------------------------------------------+
| name                      | label                | category | description                              |
+---------------------------+----------------------+----------+------------------------------------------+
| core/get-site-info        | Get Site Information | site     | Returns site information configured i... |
| core/get-user-info        | Get User Information | user     | Returns basic profile details for the... |
+---------------------------+----------------------+----------+------------------------------------------+

# List abilities in a specific category.
$ wp ability list --category=site

# List abilities by namespace.
$ wp ability list --namespace=core

# List abilities exposed to REST API.
$ wp ability list --show-in-rest=true

# List abilities as JSON.
$ wp ability list --format=json

# List only ability names.
$ wp ability list --field=name
core/get-site-info
core/get-user-info
core/get-environment-info

```

### wp ability get

[](#wp-ability-get)

Gets details about a registered ability.

```
wp ability get  [--field=] [--fields=] [--format=]

```

**OPTIONS**

```

	The ability name (namespace/ability-name format).

[--field=]
	Instead of returning the whole ability, returns the value of a single field.

[--fields=]
	Limit the output to specific fields. Defaults to all fields.

[--format=]
	Render output in a particular format.
	---
	default: table
	options:
	  - table
	  - csv
	  - json
	  - yaml
	---

```

**AVAILABLE FIELDS**

- name
- label
- category
- description
- input\_schema
- output\_schema
- readonly
- destructive
- idempotent
- show\_in\_rest

**EXAMPLES**

```
# Get details of a specific ability.
$ wp ability get core/get-site-info
+---------------+----------------------+
| Field         | Value                |
+---------------+----------------------+
| name          | core/get-site-info   |
| label         | Get Site Information |
| category      | site                 |
| description   | Returns site info... |
| input_schema  | {"type":"object"}    |
| output_schema | {"type":"object"}    |
| readonly      | 1                    |
| destructive   | 0                    |
| idempotent    | 1                    |
| show_in_rest  | 1                    |
+---------------+----------------------+

# Get ability as JSON.
$ wp ability get core/get-site-info --format=json

# Get only the description.
$ wp ability get core/get-site-info --field=description
Returns site information configured in WordPress.

```

### wp ability run

[](#wp-ability-run)

Executes a registered ability.

```
wp ability run  [--input=] [--=] [--format=]

```

**OPTIONS**

```

	The ability name (namespace/ability-name format).

[--input=]
	JSON string containing input data for the ability. Use '-' to read from stdin.

[--=]
	Individual input fields. Alternative to --input for simple inputs.

[--format=]
	Render output in a particular format.
	---
	default: json
	options:
	  - json
	  - yaml
	  - var_export
	---

```

**EXAMPLES**

```
# Execute an ability.
$ wp ability run core/get-site-info --user=admin
{
    "name": "Test Blog",
    "description": "Just another WordPress site",
    "url": "http://example.com",
    ...
}

# Execute an ability with JSON input (required for array values).
$ wp ability run core/get-site-info --input='{"fields":["name","version"]}' --user=admin
{
    "name": "Test Blog",
    "version": "6.9"
}

# Execute an ability with simple string arguments.
$ wp ability run my-plugin/greet --name=World

# Execute and output as YAML.
$ wp ability run core/get-site-info --format=yaml --user=admin
name: Test Blog
description: Just another WordPress site
...

# Execute with input from stdin.
$ echo '{"fields":["name"]}' | wp ability run core/get-site-info --input=- --user=admin

```

### wp ability exists

[](#wp-ability-exists)

Checks whether an ability is registered.

```
wp ability exists

```

Exits with return code 0 if the ability exists, 1 if it does not.

**OPTIONS**

```

	The ability name (namespace/ability-name format).

```

**EXAMPLES**

```
# Check if an ability exists.
$ wp ability exists core/get-site-info
$ echo $?
0

# Check for non-existent ability.
$ wp ability exists nonexistent/ability
$ echo $?
1

# Use in a script.
$ if wp ability exists core/get-site-info; then
>   wp ability run core/get-site-info
> fi

```

### wp ability can-run

[](#wp-ability-can-run)

Checks if the current user can execute an ability.

```
wp ability can-run  [--input=] [--=]

```

Validates permissions without actually executing the ability. Exits with return code 0 if permitted, 1 if not.

**OPTIONS**

```

	The ability name (namespace/ability-name format).

[--input=]
	JSON string containing input data for permission checking.

[--=]
	Individual input fields for permission checking.

```

**EXAMPLES**

```
# Check if current user can run an ability (as admin).
$ wp ability can-run core/get-site-info --user=admin
$ echo $?
0

# Check permission when not permitted.
$ wp ability can-run core/get-site-info
$ echo $?
1

# Use in a script.
$ if wp ability can-run core/get-site-info --user=admin; then
>   wp ability run core/get-site-info --user=admin
> fi

```

### wp ability validate

[](#wp-ability-validate)

Validates input against an ability's schema.

```
wp ability validate  [--input=] [--=]

```

Validates the input data without executing the ability. Useful for testing input before execution.

**OPTIONS**

```

	The ability name (namespace/ability-name format).

[--input=]
	JSON string containing input data to validate.

[--=]
	Individual input fields to validate.

```

**EXAMPLES**

```
# Validate input for an ability (use JSON for array values).
$ wp ability validate core/get-site-info --input='{"fields":["name","version"]}'
Success: Input is valid.

# Validate simple string arguments.
$ wp ability validate my-plugin/greet --name=World
Success: Input is valid.

# Validation failure shows error message.
$ wp ability validate core/get-site-info --input='{"fields":"invalid"}'
Error: Ability "core/get-site-info" has invalid input. Reason: ...

```

### wp ability category

[](#wp-ability-category)

Lists and inspects ability categories registered via the WordPress Abilities API.

```
wp ability category

```

The Abilities API, introduced in WordPress 6.9, uses categories to organize related abilities for better discoverability.

**EXAMPLES**

```
# List all registered ability categories.
$ wp ability category list
+------+-------+-----------------------------------------------------+
| slug | label | description                                         |
+------+-------+-----------------------------------------------------+
| site | Site  | Abilities that retrieve or modify site information. |
| user | User  | Abilities that retrieve or modify user information. |
+------+-------+-----------------------------------------------------+

# Get details of a specific category.
$ wp ability category get site
+-------------+-----------------------------------------------------+
| Field       | Value                                               |
+-------------+-----------------------------------------------------+
| slug        | site                                                |
| label       | Site                                                |
| description | Abilities that retrieve or modify site information. |
| meta        | {}                                                  |
+-------------+-----------------------------------------------------+

# Check if a category exists.
$ wp ability category exists site
$ echo $?
0

```

### wp ability category list

[](#wp-ability-category-list)

Lists all registered ability categories.

```
wp ability category list [--field=] [--fields=] [--format=]

```

**OPTIONS**

```
[--field=]
	Prints the value of a single field for each category.

[--fields=]
	Limit the output to specific category fields.

[--format=]
	Render output in a particular format.
	---
	default: table
	options:
	  - table
	  - csv
	  - json
	  - yaml
	  - count
	---

```

**AVAILABLE FIELDS**

These fields will be displayed by default for each category:

- slug
- label
- description

**EXAMPLES**

```
# List all categories.
$ wp ability category list
+------+-------+-----------------------------------------------------+
| slug | label | description                                         |
+------+-------+-----------------------------------------------------+
| site | Site  | Abilities that retrieve or modify site information. |
| user | User  | Abilities that retrieve or modify user information. |
+------+-------+-----------------------------------------------------+

# List categories as JSON.
$ wp ability category list --format=json
[{"slug":"site","label":"Site","description":"..."},{"slug":"user",...}]

# List only category slugs.
$ wp ability category list --field=slug
site
user

```

### wp ability category get

[](#wp-ability-category-get)

Gets details about a registered ability category.

```
wp ability category get  [--field=] [--fields=] [--format=]

```

**OPTIONS**

```

	The category slug.

[--field=]
	Instead of returning the whole category, returns the value of a single field.

[--fields=]
	Limit the output to specific fields. Defaults to all fields.

[--format=]
	Render output in a particular format.
	---
	default: table
	options:
	  - table
	  - csv
	  - json
	  - yaml
	---

```

**AVAILABLE FIELDS**

- slug
- label
- description
- meta

**EXAMPLES**

```
# Get details of a specific category.
$ wp ability category get site
+-------------+-----------------------------------------------------+
| Field       | Value                                               |
+-------------+-----------------------------------------------------+
| slug        | site                                                |
| label       | Site                                                |
| description | Abilities that retrieve or modify site information. |
| meta        | {}                                                  |
+-------------+-----------------------------------------------------+

# Get category as JSON.
$ wp ability category get site --format=json
{"slug":"site","label":"Site","description":"...","meta":"{}"}

# Get only the label.
$ wp ability category get site --field=label
Site

```

### wp ability category exists

[](#wp-ability-category-exists)

Checks whether an ability category is registered.

```
wp ability category exists

```

Exits with return code 0 if the category exists, 1 if it does not.

**OPTIONS**

```

	The category slug.

```

**EXAMPLES**

```
# Check if a category exists.
$ wp ability category exists site
$ echo $?
0

# Check for non-existent category.
$ wp ability category exists nonexistent
$ echo $?
1

# Use in a script.
$ if wp ability category exists site; then
>   echo "Category exists"
> fi

```

Installing
----------

[](#installing)

This package is included with WP-CLI itself, no additional installation necessary.

To install the latest version of this package over what's included in WP-CLI, run:

```
wp package install git@github.com:wp-cli/ability-command.git

```

Contributing
------------

[](#contributing)

We appreciate you taking the initiative to contribute to this project.

Contributing 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.

For 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.

### Reporting a bug

[](#reporting-a-bug)

Think you’ve found a bug? We’d love for you to help us get it fixed.

Before you create a new issue, you should [search existing issues](https://github.com/wp-cli/ability-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.

Once 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/ability-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/).

### Creating a pull request

[](#creating-a-pull-request)

Want to contribute a new feature? Please first [open a new issue](https://github.com/wp-cli/ability-command/issues/new) to discuss whether the feature is a good fit for the project.

Once 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.

### License

[](#license)

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

Support
-------

[](#support)

GitHub issues aren't for general support questions, but there are other venues you can try:

*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.*

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance89

Actively maintained with recent releases

Popularity37

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~93 days

Total

2

Last Release

15d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6dde7f578e5530884238e7173f768ae3a890b6d66eb99262a82f2c494a1b67d4?d=identicon)[schlessera](/maintainers/schlessera)

![](https://avatars.githubusercontent.com/u/841956?v=4)[Pascal Birchler](/maintainers/swissspidy)[@swissspidy](https://github.com/swissspidy)

---

Top Contributors

[![swissspidy](https://avatars.githubusercontent.com/u/841956?v=4)](https://github.com/swissspidy "swissspidy (24 commits)")[![schlessera](https://avatars.githubusercontent.com/u/83631?v=4)](https://github.com/schlessera "schlessera (6 commits)")[![ernilambar](https://avatars.githubusercontent.com/u/2098823?v=4)](https://github.com/ernilambar "ernilambar (3 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

### Embed Badge

![Health badge](/badges/wp-cli-ability-command/health.svg)

```
[![Health](https://phpackages.com/badges/wp-cli-ability-command/health.svg)](https://phpackages.com/packages/wp-cli-ability-command)
```

###  Alternatives

[wp-cli/core-command

Downloads, installs, updates, and manages a WordPress installation.

5211.3M30](/packages/wp-cli-core-command)[wp-cli/entity-command

Manage WordPress comments, menus, options, posts, sites, terms, and users.

1069.8M84](/packages/wp-cli-entity-command)[wp-cli/scaffold-command

Generates code for post types, taxonomies, blocks, plugins, child themes, etc.

1728.4M22](/packages/wp-cli-scaffold-command)[wp-cli/extension-command

Manages plugins and themes, including installs, activations, and updates.

909.9M83](/packages/wp-cli-extension-command)[wp-cli/checksum-command

Verifies file integrity by comparing to published checksums.

338.3M14](/packages/wp-cli-checksum-command)[wp-cli/i18n-command

Provides internationalization tools for WordPress projects.

11811.6M67](/packages/wp-cli-i18n-command)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
