wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_has_ability_category › WordPress Function

Since6.9.0
Deprecatedn/a
wp_has_ability_category ( $slug )
Parameters:
  • (string) $slug The slug of the ability category to check.
    Required: Yes
See:
Returns:
  • (bool) `true` if the ability category is registered, `false` otherwise.
Defined at:
Codex:

Checks if an ability category is registered.

Use this for conditional logic and feature detection before attempting to retrieve or use an ability category. Example: // Displays different UI based on available ability categories. if ( wp_has_ability_category( 'premium-features' ) ) { echo 'Premium Features Available'; } else { echo 'Standard Features'; }


Source

function wp_has_ability_category( string $slug ): bool {
	$registry = WP_Ability_Categories_Registry::get_instance();
	if ( null === $registry ) {
		return false;
	}

	return $registry->is_registered( $slug );
}