brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: wp cap list shows exactly what a WordPress role is allowed to do

WordPress
~/tips/tip-wordpress-cap-list-role

wp cap list editor | sort

Prints the capabilities of a role so you can see what editors or shop managers may do.

Role names don’t tell you much. An editor can do more than most people think, and plugins quietly add capabilities to existing roles.

wp cap list editor | sort

This prints every capability of the editor role, one per line, and sort puts them in order. You’ll see things like edit_others_posts, unfiltered_html and manage_categories, plus old level_7 style entries that WordPress keeps for backward compatibility.

I find it most useful to compare two sites, or a site before and after installing a plugin:

wp cap list shop_manager > before.txt

Run it again later and diff the files. --format=json or --format=count work too, and --show-grant shows each capability together with its grant value.

If you want to change a role, wp cap add and wp cap remove exist. Keep in mind that roles live in the database, in the wp_user_roles option. A change there stays after the plugin that wanted it is gone, so removing a plugin does not always undo what it did to your roles. This listing is the quickest way to spot that.

Further reading: wp cap list, Roles and capabilities

More WordPress tips wp user application-password create anna backup-script --porcelain define( 'MEDIA_TRASH', true ); wp cli check-update wp theme delete --all wp media image-size All WordPress tips (85) All topics

Link