Complianz controls access to its Dashboard/Wizard and settings via a WordPress capability: manage_privacy. If a role (or a specific user) doesn’t have this capability, that role/user won’t be able to manage Complianz.
This guide shows how to add and remove that capability for any role, including custom roles. We’ll use Editor as the example role.
WordPress permissions are based on capabilities, not just roles. When you add a capability to a role or a user, the change is persistent (stored in the database) until you explicitly remove it.
We will explore two approaches with the Editor role: granting access to a specific editor account or to all accounts that have this role.
Option 1: Grant access to a single Editor user (recommended)
Use this when you want only one specific Editor to manage Complianz.
How it works
- Find the Editor user ID (querying the
wp_userstable comes in handy) - Add the capability
manage_privacyto that user
Code (add capability)
Add this as a temporary snippet (preferably in a small custom plugin, see the “Clean add/remove” section below):
add_action('init', function () {
$user_id = 123; // <- your Editor user ID
$user = get_user_by('id', $user_id);
if (!$user) return;
if (!$user->has_cap('manage_privacy')) {
$user->add_cap('manage_privacy');
}
});
Option 2: Grant access to all Editors (modify the Editor role)
Use this when you want every Editor to access Complianz.
Code (add capability to the Editor role)
add_action('init', function () {
$role = get_role('editor');
if (!$role) return;
if (!$role->has_cap('manage_privacy')) {
$role->add_cap('manage_privacy');
}
});
Revoking access
If you removed the code but the Editor still has access, that’s expected: the capability is still stored in the database.
1. Revoke from a single user
add_action('init', function () {
$user_id = 123; // <- your Editor user ID
$user = get_user_by('id', $user_id);
if (!$user) return;
$user->remove_cap('manage_privacy');
});
2. Revoke from the Editor role
add_action('init', function () {
$role = get_role('editor');
if (!$role) return;
$role->remove_cap('manage_privacy');
});
Important: After revoking, log out and log back in (or clear object cache) to ensure capabilities are refreshed.