Add "clear cache" option to shop owner role in WPRocket

PHOTO EMBED

Wed Sep 01 2021 13:20:42 GMT+0000 (UTC)

Saved by @Alz #php

// add clear cache option to shop owner
function wp_rocket_add_purge_cache_to_shop_owner() {
	// gets the shop owner role object
	$role = get_role('shop_manager');
 
	// add a new capability
	$role->add_cap('rocket_purge_cache', true);
}
add_action('init', 'wp_rocket_add_purge_cache_to_shop_owner', 12);
content_copyCOPY

https://docs.wp-rocket.me/article/1280-customize-access-to-options-for-user-roles#custom-code