Hi @angeloarlotta
I’m sorry but currently we don’t have option to remove these user capabilities.
If you no longer use Smart Slider 3, you can remove these capabilities. Add this code to your theme’s functions.php file:
function remove_SmartSlider_capabilities() {
$role = get_role( 'administrator' );
if (is_object($role)) {
$role->remove_cap( 'smartslider' );
$role->remove_cap( 'smartslider_config' );
$role->remove_cap( 'smartslider_edit' );
$role->remove_cap( 'smartslider_delete' );
$role->remove_cap( 'nextend_config' );
$role->remove_cap( 'nextend_visual_edit' );
$role->remove_cap( 'nextend_visual_delete' );
}
$role = get_role('editor');
if (is_object($role)) {
$role->remove_cap( 'smartslider' );
$role->remove_cap( 'smartslider_config' );
$role->remove_cap( 'smartslider_edit' );
$role->remove_cap( 'smartslider_delete' );
$role->remove_cap( 'nextend_config' );
$role->remove_cap( 'nextend_visual_edit' );
$role->remove_cap( 'nextend_visual_delete' );
}
}
remove_SmartSlider_capabilities();
Then refresh your backend. The capabilities should be removed, and you can remove this code after that.
Sorry @nextend_ramona At first time the capabilities were deleted but they reappeared all again…
That’s weird. The capabilities weren’t restored for me on my test site.
Is Smart Slider 3 (Free or Pro) enabled for you? Probably it re-created the capabilities.
If you don’t have Smart Slider 3 installed, then none of our codes are on your site, so whatever is placing these capabilities back, it’s not related to us.
Maybe you have some kind of “backup” plugin that restored your database to the state where the capabilities weren’t removed yet?
Alternatively, you could put back the code suggested above to your theme’s functions.php file and leave it there, so it wouldn’t allow recreating these capabilities. (Just make sure you remove the code if you decide to install Smart Slider 3 again.)
The plugin wasn’t installed, and when the capabilities were recreated the code was still in functions.php
Thanks to your inputs I found this code and seems working on my end, I will paste here if can be useful to other users:
add_action( 'admin_init', 'clean_unwanted_caps' );
function clean_unwanted_caps() {
global $wp_roles;
$delete_caps = array(
'smartslider_delete',
'smartslider',
'smartslider_config',
'smartslider_edit',
'nextend_visual_delete',
'nextend_visual_edit',
'nextend_config',
'nextend',
);
foreach ($delete_caps as $cap) {
foreach (array_keys($wp_roles->roles) as $role) {
$wp_roles->remove_cap($role, $cap);
}
}
}
Maybe it’s because the code you posted mention administrators and editors roles only, this one instead works on all global roles.
Thanks again
Maybe it’s because the code you posted mention administrators and editors roles only, this one instead works on all global roles.
That might be. By default we create and assign the capabilities for editor and administrator roles only, so I assumed cleaning that up would help.
Anyway, I’m glad you were able to figure it out!