• Resolved chukapi

    (@chukapi)


    Hi,

    Just wanted to know if it’s possible to delete old capabilities ?

    For example : the plugin mailpoet goes updated and stoped using the wysija_config and else, i don’t want to use them anymore so i want to delete to “clear” the capabilities dashboard.

    Thanks in advance,

    • This topic was modified 3 years, 1 month ago by chukapi.
Viewing 1 replies (of 1 total)
  • Plugin Author Caseproof

    (@caseproof)

    Hi @chukapi

    You can use the following snippet at the end of your theme’s functions.php file. Change the capabilities as required and run the snippet once. You would need to disable or comment out this snippet straight after you run it.

    add_action( 'admin_init', 'clean_unwanted_caps' );
    function clean_unwanted_caps() {
      global $wp_roles;
      $delete_caps = array(
        'wysija_config',
        'capability2'
      );
      foreach ($delete_caps as $cap) {
        foreach (array_keys($wp_roles->roles) as $role) {
    	$wp_roles->remove_cap($role, $cap);
        }
      }
    }

    Kind regards

Viewing 1 replies (of 1 total)
  • The topic ‘Delete old capabilities’ is closed to new replies.