Customize Access to Options According to User Roles

In this Article

By default, you must be an Administrator to have access to any and all of WP Rocket's settings and options. 

But you can customize this, and grant other user roles access to some or all of WP Rocket's options. There are 2 possible ways to do this: 

Customize access with User Role Editor Plugin

Assign Capabilities

  1. Install and activate the User Role Editor plugin
  2. Go to Users > User Role Editor
  3. Choose which user role to edit
  4. Click on WP Rocket from the "Group" list
  5. Select which capabilities to give this user role

Available Capabilities

The following capabilities can be assigned to users to provide access to very specific settings in WP Rocket:


User will have access to the Clear Cache, or Clear and preload cache if the Preload is enabled, link in the WP Rocket admin toolbar.


User will be able clear the cache of specific pieces of content


User will be able to clear the cache of specific taxonomies like categories:


If the user has been given access to manage other users in WordPress, and User Cache is enabled in WP Rocket, they will be able to clear the cache of specific users:


If the Sucuri add-on is enabled in WP Rocket, AND the user has been granted access to rocket_manage_options, the user will be able to clear the Sucuri cache from the add-on tab


Heads up: this capability only applies to WP Rocket versions older than 3.12.

If Preload is activated in WP Rocket, the user will have access to the Preload cache link in the admin toolbar:


If Load CSS Asynchronously is activated in WP Rocket, the user will have access to the Regenerate Critical Path CSS link in the admin toolbar:


Heads up! This capability should not be assigned alone, it requires some additional capabilities to work correctly. See below.

User will be able to access and manage the WP Rocket settings page. When assigning this capability, it's required to also assign them the following capabilities as well: 

  • rocket_regenerate_critical_css
  • rocket_purge_cache
  • rocket_purge_cloudflare_cache
  • rocket_purge_sucuri_cache
  • rocket_preload_cache

Use custom code

You can write your own custom functions to assign capabilities. Here is an example of how to give the Author role the ability to purge posts:

function wp_rocket_add_purge_posts_to_author() {
	// gets the author role object
	$role = get_role('author');
	// add a new capability
	$role->add_cap('rocket_purge_posts', true);
add_action('init', 'wp_rocket_add_purge_posts_to_author', 12);

Capabilities are persistent and saved in the database. Even if you remove the code snippet, the user role will still have the capability until you explicitly remove it with remove_cap

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.