superpowers-sage:wp-capabilities

Implement WordPress role-based authorization with capabilities and meta-capabilities for Sage/Acorn projects.

13|Updated Mar 19, 2026
One-click install
npx skills add https://github.com/hekivo/superpowers-sage --skill superpowers-sage-wp-capabilities-hekivo
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: superpowers-sage:wp-capabilities
Source: https://github.com/hekivo/superpowers-sage/tree/main/skills/wp-capabilities
Command: npx skills add https://github.com/hekivo/superpowers-sage --skill superpowers-sage-wp-capabilities-hekivo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you implement correct WordPress authorization so users can only access the roles, capabilities, and meta-capabilities your Sage/Acorn project intends.

Core Features & Use Cases

  • Capability hierarchy mapping: Understand and apply Roles → Capabilities → Meta Capabilities, including dynamic mapping via map_meta_cap.
  • Custom capability management for CPTs: Register and grant CPT-derived capabilities (e.g., edit_projects, publish_projects) to roles.
  • Runtime authorization checks: Use current_user_can() for admin, REST, and route-level permission callbacks.
  • Acorn/Laravel-style integration patterns: Bridge WordPress authorization to Gates/Policies and JWT middleware guards while ensuring the WP current user context is set correctly.
  • Verification guidance: Test with WP-CLI role/cap lists and runtime audits to confirm checks behave as expected.

Quick Start

Instruct your AI assistant to map your custom post type permissions (via map_meta_cap), grant the resulting capabilities to the correct roles once on activation, and wire a REST permission callback and/or Acorn Gate that uses current_user_can() with the right capability name for the protected action.

Frequently Asked Questions about superpowers-sage:wp-capabilities

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement WordPress role-based authorization for custom post types?▼

WordPress role-based authorization translates user roles into capabilities and meta-capabilities for protected resources. You register CPTs with correct capability_type and map_meta_cap, assign derived capabilities to roles on activation, and enforce runtime checks using current_user_can within permission callbacks.

How does map_meta_cap work for dynamic WordPress capability checks?▼

The map_meta_cap mechanism dynamically translates meta-capabilities into primitive capabilities for protected resources. It allows WordPress to evaluate permissions contextually, mapping high-level actions like edit_post into specific capabilities such as edit_projects based on custom post type registration settings.

Can I use Laravel Gates and Policies with WordPress JWT authorization in Sage?▼

Yes, Sage/Acorn development supports bridging WordPress authorization to Laravel-style Gates and Policies. You can wire JWT middleware guards alongside WordPress current_user_can checks, ensuring the WP current user context is set correctly before evaluating route-level permissions.

What's the best way to secure WordPress REST API routes using capabilities and roles?▼

Securing WordPress REST API routes involves applying role-based authorization through permission callbacks. You enforce current_user_can checks with the correct capability name for each protected action, optionally wrapping the logic in Acorn Gate or Policy middleware for structured access control.

Do I need to manually assign custom post type capabilities to WordPress user roles?▼

Yes, custom post type capabilities must be granted to roles once during plugin or theme activation. After registering CPTs with map_meta_cap, you programmatically assign the resulting capabilities, such as edit_projects or publish_projects, to the appropriate user roles to enable proper access control.

Why are my WordPress REST permission callbacks failing for custom capabilities?▼

REST permission callbacks fail when CPT registration lacks correct capability_type and map_meta_cap settings, or when capabilities are not properly assigned to roles. Verify your setup using WP-CLI role and capability lists, and perform runtime audits to confirm current_user_can checks behave as expected.