Recall & Review
beginner
What is the purpose of user capability checks in WordPress?
User capability checks control what actions a user can perform based on their role and permissions. They help keep the site secure by limiting access to sensitive features.
Click to reveal answer
beginner
Which WordPress function is commonly used to check if a user has a specific capability?
The
current_user_can() function checks if the current logged-in user has a given capability, returning true or false.Click to reveal answer
beginner
How do you check if a user can edit posts in WordPress?
Use
current_user_can('edit_posts'). It returns true if the user has permission to edit posts, false otherwise.Click to reveal answer
intermediate
Why should you always use capability checks before performing sensitive actions in WordPress?
To prevent unauthorized users from accessing or changing data they shouldn't. It protects your site from security risks and accidental damage.
Click to reveal answer
intermediate
What is the difference between roles and capabilities in WordPress?
Roles are groups of capabilities assigned to users. Capabilities are specific permissions like 'edit_posts' or 'manage_options'. Roles bundle capabilities for easier management.
Click to reveal answer
Which function checks if the current user can perform a specific action in WordPress?
✗ Incorrect
The correct function is current_user_can(), which checks user capabilities.
What does current_user_can('edit_posts') return if the user cannot edit posts?
✗ Incorrect
It returns false if the user does not have the 'edit_posts' capability.
Which WordPress concept groups multiple capabilities together for users?
✗ Incorrect
Roles group capabilities to assign sets of permissions to users.
Why is it important to check user capabilities before showing admin options?
✗ Incorrect
Checking capabilities prevents unauthorized users from accessing sensitive features.
Which capability would you check to allow a user to manage site settings?
✗ Incorrect
The 'manage_options' capability allows users to manage site settings.
Explain how user capability checks help secure a WordPress site.
Think about who can do what on your site and how you stop others.
You got /4 concepts.
Describe the difference between roles and capabilities in WordPress and why both are useful.
Roles are like job titles; capabilities are the tasks allowed.
You got /4 concepts.