wpseek.com
WordPress开发者和主题制作者的搜索引擎



wp_unregister_ability › WordPress Function

Since6.9.0
已弃用n/a
› wp_unregister_ability ( $name )
参数:
  • (string) $name The name of the ability to unregister, including namespace prefix (e.g., 'my-plugin/my-ability').
    Required: Yes
查看:
返回:
  • (WP_Ability|null) The unregistered ability instance on success, `null` on failure.
定义在:
文档:

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


源码

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

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