Quick Start
Use AAM::api() after AAM has loaded. A service without an access-level argument uses the current user, or the visitor for an anonymous request.
Set a rule
// All users in the Subscriber role inherit this post rule.
$posts = AAM::api()->posts('role:subscriber');
$posts->deny(34, ['list', 'read']);
list hides the post from listings; read restricts direct access. The post must exist. Check the return value when the write matters to your workflow.
Check a decision
$posts = AAM::api()->posts(); // Current user or visitor.
if ($posts->is_restricted(34)) {
// Return your application's access-denied response.
}
AAM’s WordPress integrations enforce supported rules during ordinary requests. In your own endpoint, command, or rendering flow, act on the result yourself.
Change the subject
AAM::api()->posts('user:42'); // One user.
AAM::api()->posts('role:editor'); // One role.
AAM::api()->posts('visitor'); // Anonymous visitors.
AAM::api()->posts('default'); // Baseline inherited by other levels.
Use Access levels to understand inheritance before writing a broad default rule. Browse Services for accepted identifiers, methods, and examples.