Title: wp_get_ability
Published: February 24, 2026
Last modified: August 20, 2026

---

# wp_get_ability( string $name ): 󠀁[WP_Ability](https://developer.wordpress.org/reference/classes/wp_ability/)󠁿|null

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_get_ability/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/wp_get_ability/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/functions/wp_get_ability/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_get_ability/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_get_ability/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_get_ability/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_get_ability/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_get_ability/?output_format=md#wp--skip-link--target)

Retrieves a registered ability.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_get_ability/?output_format=md#description)󠁿

Returns the ability instance for inspection or use. The instance provides access
to the ability’s configuration, metadata, and execution methods.

Example:

    ```php
    // Prints information about a registered ability.
    $ability = wp_get_ability( 'my-plugin/export-data' );
    if ( $ability ) {
        echo $ability->get_label() . ': ' . $ability->get_description();
    }
    ```

### 󠀁[See also](https://developer.wordpress.org/reference/functions/wp_get_ability/?output_format=md#see-also)󠁿

 * [WP_Abilities_Registry::get_registered()](https://developer.wordpress.org/reference/classes/WP_Abilities_Registry/get_registered/)
 * [wp_has_ability()](https://developer.wordpress.org/reference/functions/wp_has_ability/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/wp_get_ability/?output_format=md#parameters)󠁿

 `$name`stringrequired

The name of the ability, including namespace prefix (e.g., `'my-plugin/my-ability'`).

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_get_ability/?output_format=md#return)󠁿

 [WP_Ability](https://developer.wordpress.org/reference/classes/wp_ability/)|null
The registered ability instance, or `null` if not registered.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_get_ability/?output_format=md#source)󠁿

    ```php
    function wp_get_ability( string $name ): ?WP_Ability {
    	$registry = WP_Abilities_Registry::get_instance();
    	if ( null === $registry ) {
    		return null;
    	}

    	return $registry->get_registered( $name );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/abilities-api.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/abilities-api.php#L401)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/abilities-api.php#L401-L408)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_get_ability/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Abilities_Registry::get_instance()](https://developer.wordpress.org/reference/classes/wp_abilities_registry/get_instance/)`wp-includes/abilities-api/class-wp-abilities-registry.php` |

Utility method to retrieve the main instance of the registry class.

  |

| Used by | Description | 
| [WP_REST_Abilities_V1_Run_Controller::sanitize_input_for_ability()](https://developer.wordpress.org/reference/classes/wp_rest_abilities_v1_run_controller/sanitize_input_for_ability/)`wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-run-controller.php` |

Sanitizes the run input by coercing it to the ability’s input schema.

  | 
| [WP_AI_Client_Prompt_Builder::using_abilities()](https://developer.wordpress.org/reference/classes/wp_ai_client_prompt_builder/using_abilities/)`wp-includes/ai-client/class-wp-ai-client-prompt-builder.php` |

Registers WordPress abilities as function declarations for the AI model.

  | 
| [WP_AI_Client_Ability_Function_Resolver::execute_ability()](https://developer.wordpress.org/reference/classes/wp_ai_client_ability_function_resolver/execute_ability/)`wp-includes/ai-client/class-wp-ai-client-ability-function-resolver.php` |

Executes a WordPress ability from a function call.

  | 
| [WP_REST_Abilities_V1_Run_Controller::execute_ability()](https://developer.wordpress.org/reference/classes/wp_rest_abilities_v1_run_controller/execute_ability/)`wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-run-controller.php` |

Executes an ability.

  | 
| [WP_REST_Abilities_V1_Run_Controller::check_ability_permissions()](https://developer.wordpress.org/reference/classes/wp_rest_abilities_v1_run_controller/check_ability_permissions/)`wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-run-controller.php` |

Checks if a given request has permission to execute a specific ability.

  | 
| [WP_REST_Abilities_V1_List_Controller::get_item()](https://developer.wordpress.org/reference/classes/wp_rest_abilities_v1_list_controller/get_item/)`wp-includes/rest-api/endpoints/class-wp-rest-abilities-v1-list-controller.php` |

Retrieves a specific ability.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/wp_get_ability/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_get_ability/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_get_ability/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.9.0](https://developer.wordpress.org/reference/since/6.9.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_get_ability%2F)
before being able to contribute a note or feedback.