Skip to content
  • Home
  • About
  • No Access
  • Privacy Policy
Bits of .NET
Bits of .NET
  • C#
  • Asp.Net Core
  • SQL
  • Windows
  • WordPress
  • AI
  • JavaScript
  • CSS
  • MORE
    • HTML
    • Ajax
    • Git
    • Docker
    • Kubernetes
    • Photoshop
    • Visual Studio

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • C#
  • Asp.Net Core
  • SQL
  • Windows
  • WordPress
  • AI
  • JavaScript
  • CSS
  • MORE
    • HTML
    • Ajax
    • Git
    • Docker
    • Kubernetes
    • Photoshop
    • Visual Studio
Wordpress

WordPress: Understand User Roles and Capabilities for Better Security

- 07.06.26 - ErcanOPAK

👥 Never Give Admin to Everyone

Admin has all powers. User roles limit access. Editor writes, Author edits own, Subscriber reads only. Least privilege principle.

📝 Default Roles

Administrator:
- Full control over site
- Add/delete users, install plugins, edit themes
- Risk: Can break everything

Editor:
- Publish and manage all posts/pages
- Moderate comments, manage categories
- Cannot install plugins or change theme

Author:
- Publish and manage own posts
- Upload files
- Cannot edit others' posts

Contributor:
- Write and edit own posts (not published)
- No upload rights
- Editor/Admin must publish

Subscriber:
- Read-only access
- Manage own profile only

🎯 Custom Roles

// Add custom role
add_role('store_manager', 'Store Manager', array(
    'read' => true,
    'edit_products' => true,
    'publish_products' => true,
    'edit_orders' => true
));

// Check capabilities
if (current_user_can('edit_products')) {
    // Show product editor
}

// Capability check in template
if (is_user_logged_in() && user_can($user_id, 'publish_posts')) {
    echo '<a href="post-new.php">New Post</a>';
}

💡 Best Practices

  • Only 1-2 Administrator accounts (use for maintenance only)
  • Regular users as Subscriber or Contributor
  • Use plugins to audit user capabilities
  • Never give admin to untrusted users

“Content writer accidentally deleted plugin. Changed role to Author (can’t access plugins). Problem solved. Least privilege saves headaches.”

— WordPress Security Consultant

Related posts:

WordPress: Use REST API for Headless CMS

WordPress: Use REST API for Headless CMS

WordPress: Database Replication for High Availability

WordPress: Database Replication for High Availability

WordPress: Fix REST API Requests Returning 401 Because a Security Plugin Disabled Application Passwo...

WordPress: Fix REST API Requests Returning 401 Because a Security Plugin Disabled Application Passwo...

Views: 12
Found this useful? Share it
XLinkedInWhatsApp

Post navigation

Photoshop: Use Match Color to Unify Colors Across Photos
Kubernetes: Use Namespaces to Organize Your Cluster

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Most Read

  1. 01How to make theater mode the default for Youtube 1,079 views
  2. 02How to add default value for Entity Framework migrations for DateTime and Bool 997 views
  3. 03Get the User Name and Domain Name from an Email Address in SQL 996 views
  4. 04Get the First and Last Word from a String or Sentence in SQL 873 views
  5. 05How to select distinct rows in a datatable in C# 868 views
  6. 06How to enable, disable and check if Service Broker is enabled on a database in SQL Server 671 views
  7. 07Add Constraint to SQL Table to ensure email contains @ 631 views
  8. 08Average of all values in a column that are not zero in SQL 584 views
  9. 09How to use Map Mode for Vertical Scroll Mode in Visual Studio 562 views
Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
Back to top
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com