Support » Plugin: Members - Membership & User Role Editor Plugin » How to delete custom capability

  • I created a custom capability and it added it correctly, but i would like to delete the capability but there is no option to do so… so how do I delete a custom capability from my list of permissions?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Caseproof


    Hi @lukag

    Unfortunately, there’s currently no way to remove capabilities that are created. The only way to actually “remove” them would be to modify the database option that stores the roles and capabilities. Otherwise, simply denying a role that capability will have the same effect.


    @lukag – you can use the following php snippet. In this example I am removing unwanted capabilities after removing MailPoet plugin. Fill the array as required and run the snippet once. You would need to disable or comment out this snippet straight after you run it. Hope this helps.

    // Function to delete capabilities
    // Based on
    add_action( 'admin_init', 'clean_unwanted_caps' );
    function clean_unwanted_caps() {
    	global $wp_roles;
    	$delete_caps = array(
    	foreach ($delete_caps as $cap) {
    		foreach (array_keys($wp_roles->roles) as $role) {
    			$wp_roles->remove_cap($role, $cap);
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.