Skip to main content

Capabilities vs Roles: Get It Right

Check capabilities, never roles. current_user_can(‘manage_options’) survives custom roles; current_user_can(‘administrator’) breaks the first time someone adds a new admin-equivale…

March 27, 2026 WordPress chris 1 min read Security

Article takeaway

Check capabilities, never roles. current_user_can('manage_options') survives custom roles; current_user_can('administrator') breaks the first time someone adds a new admin-equivale…

Check capabilities, never roles. current_user_can('manage_options') survives custom roles; current_user_can('administrator') breaks the first time someone adds a new admin-equivalent role.

Use granular meta-capabilities like edit_post with a post ID — they invoke the capability mapper, which respects ownership and post status.

Add custom capabilities sparingly. Each one is a string the rest of the codebase has to remember; capability sprawl is real.

Share X / Twitter LinkedIn

Leave a comment

Related Posts