Ir al contenido

LeanRoles

Audit what your roles cost and act on it: convert them into tags, apply inheritance and keep the configuration lean — without breaking the site.

LeanRoles
Version0.6.1
Updated2026-08-22
RequiresWordPress 5.9+
PHP7.4+
LicenseGPL-3.0
DirectoryWordPress.org

Licence: GPL-3.0.

WordPress keeps every role in a single autoloaded option, with each role’s capabilities copied out in full. On a membership or commerce site with dozens of roles, that option is read and held in memory on every request —exactly where page caching doesn’t help. LeanRoles measures that cost and gives you the tools to bring it down.

Start with a read-only audit that writes nothing, and with user tags: a label that behaves like a role but grants no capabilities and weighs nothing. When you want to act, the Premium version turns roles into tags, applies inheritance and keeps the configuration lean.

Audit (read-only)

Measures what your roles cost, touching nothing.

Flags the dead weight

Empty roles, roles nobody holds, duplicates.

Convert to tags

Role → tag when you’re ready, and undo it (Pro).

A lean configuration

With inheritance, it stops repeating capabilities.


Unlock the Power of Premium

The read-only audit and the basic primitives are free. When you want to act on what the audit finds —convert roles, apply inheritance and keep the configuration lean— there are two paid plans.

Know what depends on each role

Reads your code and ranks it by severity, before you change anything.

Who notices

Tells you, user by user, exactly which capabilities each one would lose.

Role → tag conversion

Turn a role into a tag when you’re ready, and turn it back.

Roles that inherit

Stop carrying the same capabilities over and over.

Your plugins keep working

Translates converted roles for membership, LMS and commerce, both ways.

Resumable bulk jobs

Over tens of thousands of users: start, close, come back.

Feature Free1 site Pro$145/year Agency$499/year
Role audit (read-only, cost in memory)
User tags (create, bulk-assign, delete a role)
See what depends on each role before you touch it
Role → tag conversion (and undo)
Roles that inherit
Membership / LMS / commerce compatibility
Fleet dashboard and alerts
White-labelled reports
Sites included11–525+
MemberPress Membership · LMS · commerce WP-CLI REST API (Agency)

Pro

$145 / year

per site · 5 sites $319

Everything in Free, plus:

  • Know what genuinely depends on each role, ranked by severity, before you change anything.
  • See, user by user, exactly which capabilities each person would lose.
  • Convert a role into a tag when you’re ready —and turn it back.
  • Bulk jobs over tens of thousands of users that survive being interrupted.
  • Roles that inherit, so your configuration stops carrying the same capabilities over and over.
  • Content by tag: say one thing to wholesale buyers and nothing to everyone else.
  • Your other plugins keep working: when a membership, LMS or commerce plugin grants or revokes a converted role, LeanRoles translates it both ways, with no configuration.
  • Drift tracking: see how your configuration grows and the exact days it did.
  • Reports you can paste into a ticket or an email.

Agency

$499 / year

for 25 sites and up

Everything in Pro, plus:

  • One alert when a configuration grows past your threshold —raised once, not every day.
  • Your whole fleet on one screen: which are drifting, which are clean, and which aren’t answering.
  • Your credentials stay yours: nothing has to be stored.
  • White-labelled reports: your name, your logo, your footer. Nothing reveals who’s behind it.
  • Collect from your own tooling automatically.
  • Every bit of it scriptable, end to end.

Discounts by number of sites.


Frequently Asked Questions

Is the auditor safe to run on a production site?

Yes, and that is the point of it. It reads. The only things it writes are a twelve-hour cache of count_users() and, on activation, a restore point of your role option.

What happens to my tags if I deactivate the plugin?

They stop being injected. Because they grant no capabilities, nothing about what your users can do changes. The assignments stay in the database and come back when you reactivate.

Can my plugin use user tags without depending on LeanRoles?

Yes, and that is the point. The tag engine is a self-contained library that ships inside this plugin and can be copied into yours: one require_once and you have user_tags_add(), user_tags_get() and the rest. If several plugins bundle it, the newest copy wins and they all share one set of tags. Removing LeanRoles does not remove them.

Will current_user_can('my_tag') work?

Yes. So will in_array('my_tag', $user->roles), get_users(array('role' => 'my_tag')) and WP_Roles::is_role().

Does it work on multisite?

The auditor understands it: role options are per site and it reads the right one. Tags are per site too, since term relationships live in each site's own tables. Network-wide operations are not in this version.

Does an object cache solve the underlying problem?

It helps with query time and nothing else. Memory, unserialization and — with Redis — bandwidth all get worse, not better, because alloptions lives under a single key and crosses the wire whole on every request. The audit detects your drop-in and tones its findings down if that drop-in already compresses or splits the blob.

wp plugin install https://github.com/davefx/leanroles/releases/download/0.2.0/leanroles-0.2.0.zip --activate

Or download the ZIP and install it from Plugins → Add New.