Use this for conditional logic and feature detection before attempting to retrieve or use an ability. Example: // Displays different UI based on available abilities.
if ( wp_has_ability( 'premium-plugin/advanced-export' ) ) {
echo 'Export with Premium Features';
} else {
echo 'Basic Export';
}
Parameters
$namestring
The name of the ability to check, including namespace prefix (e.g., 'my-plugin/my-ability').
Return
bool
true if the ability is registered, false otherwise.
Signature, return type and hooks compared across 3 parsed releases.
About this page
Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-includes/abilities-api.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.