📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials WordPress Development User Roles

User Roles

5 min read Quiz at the end
WordPress roles (Subscriber to Admin) and capabilities — create custom roles for membership sites.

User Roles and Capabilities

# Built-in roles
# Subscriber    -- read only
# Contributor   -- write own posts
# Author        -- publish own posts
# Editor        -- manage all posts
# Administrator -- full control

// Check capability
if (current_user_can('manage_options')) {
    // show admin settings
}

// Current user
$user = wp_get_current_user();
echo $user->user_email;

// Custom role
add_role('premium_member', 'Premium Member', [
    'read'           => true,
    'access_courses' => true,
]);

// Add cap to role
$role = get_role('editor');
$role->add_cap('manage_ads');

// REST permission callback
'permission_callback' => function() {
    return current_user_can('access_courses');
}
Topic Quiz · 1 questions

Test your understanding before moving on

1. What is the purpose of a WordPress child theme?
💡 Child themes inherit from the parent and let you override only what you need, surviving parent updates.