$page->hasAccessRole() method

Returns whether this page has the given access role

Given access role may be a role name, role ID or Role object.


// basic usage
$bool = $page->hasAccessRole($role);

// usage with all arguments
$bool = $page->hasAccessRole($role, string $type = 'view');


rolestring, int, Role
type (optional)string

May be 'view', 'edit', 'create' or 'add' (default is 'view')

Return value


$page methods and properties

API reference based on ProcessWire core version 3.0.234

Latest news

  • ProcessWire Weekly #511
    In the 511th issue of ProcessWire Weekly we'll cover the latest core updates, introduce a new third party module called Auto AVIF, and more. Read on!
    Weekly.pw / 25 February 2024
  • Using date range fields in ProcessWire
    This week we'll take a detailed look at the newest addition to the ProFields set of modules: the Date Range Fieldtype and Inputfield.
    Blog / 24 November 2023
  • Subscribe to weekly ProcessWire news

“The end client and designer love the ease at which they can update the website. Training beyond how to log in wasn’t even necessary since ProcessWire’s default interface is straightforward.” —Jonathan Lahijani