wp_unregister_ability()WP 6.9.0

Unregisters an ability from the Abilities API.

Removes a previously registered ability from the global registry. Use this to disable abilities provided by other plugins or when an ability is no longer needed.

Can be called at any time after the ability has been registered.

Example:

if ( wp_has_ability( 'other-plugin/some-ability' ) ) {
	wp_unregister_ability( 'other-plugin/some-ability' );
}

No Hooks.

Returns

WP_Ability|null. The unregistered ability instance on success, null on failure.

Usage

wp_unregister_ability( $name ): ?WP_Ability;
$name(string) (required)
The name of the ability to unregister, including namespace prefix (e.g., 'my-plugin/my-ability').

Notes

Changelog

Since 6.9.0 Introduced.

wp_unregister_ability() code WP 7.0

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

	return $registry->unregister( $name );
}