add_cap( self::MANAGE ); } } /** * Removes the capability from every role that has it. * * @since 0.1.0 * * @return void */ public function uninstall(): void { $roles = wp_roles(); foreach ( array_keys( $roles->roles ) as $name ) { $role = get_role( $name ); if ( $role ) { $role->remove_cap( self::MANAGE ); } } } /** * Whether the current user can run the interview queue. * * @since 0.1.0 * * @return bool */ public static function can_manage(): bool { return current_user_can( self::MANAGE ) || current_user_can( 'manage_options' ); } /** * The capability the admin menu asks for. * * @since 0.1.0 * * @return string */ public static function menu_capability(): string { return current_user_can( self::MANAGE ) ? self::MANAGE : 'manage_options'; } }