wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



wp_has_ability_category › WordPress Function

Od6.9.0
Przestarzałyn/a
› wp_has_ability_category ( $slug )
Parametry:
  • (string) $slug The slug of the ability category to check.
    Wymagane: Tak
Zobacz:
Powrót:
  • (bool) `true` if the ability category is registered, `false` otherwise.
Zdefiniowane na:
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'; }


Źródło

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 );
}