Change WordPress user roles and capabilities › Forums › Give user access to plugin – how to › Need to Provide Access to Newletter plugin please help! › Reply To: Need to Provide Access to Newletter plugin please help!
09/07/2019 at 03:00
#5802
Vladimir
Keymaster
resume_plugins
and `resume_themes’ capabilities are not created by wordpress as all other WP built-in user capabilities. This capabilities are added by WordPress to the user automatically in case user has correspondent WP default capability:
/**
* Filters the user capabilities to grant the 'resume_plugins' and 'resume_themes' capabilities as necessary.
*
* @since 5.2.0
*
* @param bool[] $allcaps An array of all the user's capabilities.
* @return bool[] Filtered array of the user's capabilities.
*/
function wp_maybe_grant_resume_extensions_caps( $allcaps ) {
// Even in a multisite, regular administrators should be able to resume plugins.
if ( ! empty( $allcaps['activate_plugins'] ) ) {
$allcaps['resume_plugins'] = true;
}
// Even in a multisite, regular administrators should be able to resume themes.
if ( ! empty( $allcaps['switch_themes'] ) ) {
$allcaps['resume_themes'] = true;
}
return $allcaps;
}
As you can see from the code above, user with ‘activate_plugins’ automatically can ‘resume_plugins’ and user with ‘switch_themes’ automatically can ‘resume_themes’.