Support » Plugins » Hacks » Remove access to WordPress Plugin with custom role

  • I have created a custom role in WordPres admin with the same capabilities as an admin account. Then I have used remove_cap() to remove capabilities that I dont want the user to see.

    Though the plugin “BackWPUp” is still accessable for the user through the menu.

    I have removed capabilities like edit_plugins etc. as from the Codex, but I cant find any way to remove access to specific plugins.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    The capability checked for most plugin related display is ‘activate_plugins’. There’s no clean way to completely block specific plugins from appearing. There are filters for the action links below each plugin name and a filter for the description meta data, but nothing for the plugin name or the entire row.

    To do what you want without hacking core files would require defining your own version of WP_Plugins_List_Table, removing the current plugins menu items, and adding your own menu items that display plugins using your version of WP_Plugins_List_Table.

    You could deter many users by just hiding specific content with jQuery, but any halfway intelligent user could look at the page source to see the hidden content, or use their browser’s CSS inspector to enable the display of hidden content.

    The capability checked for most plugin related display is ‘activate_plugins’.

    …or manage_options.

    pmbs, does your custom role have manage_options capability? If so, try removing it and seeing whether that solves the issue, though it may also remove access to other plugins that you do want the custom role to have access to. If this is the case, as bcworkz says there’s no clean way around it.

    Thanks, guys. Tried removing every capability as stated here, but I guess it just isn’t possible without editing core files. Ended up removing it from the menu with CSS, which will do okay in this case.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Remove access to WordPress Plugin with custom role’ is closed to new replies.