Performance: User roles and permissions
MEDIUM IMPACT
This affects page load speed and interaction responsiveness by controlling access to backend features and frontend content rendering.
<?php $is_admin = current_user_can('administrator'); if($is_admin) { echo '<div>Admin content</div>'; } ?>
<?php if(current_user_can('administrator')) { echo '<div>Admin content</div>'; } ?>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Repeated current_user_can() calls | Minimal DOM nodes but repeated server queries | 0 | Low | [X] Bad |
| Cached permission check variable | Minimal DOM nodes with single server query | 0 | Low | [OK] Good |