I've read the entry Best Collection of Code for your functions.php file, it really help me a lot.

I only got a question, is there a way to hide some plugins options (in their respective administrations), just like the way you hide the widgets at the dashboard?. This because I have to let the editor manage some parts of the plugin, but not all (for example, in a slider, he/she must edit the images to display, but not the dimensions of the slider).


This should be easiest way, just add the line to wp-config.php, this will disable plugin and theme editor, both. define('DISALLOW_FILE_EDIT',true);

If you want to add codes into theme's function, the code should work for you.

function ra_block_tp_edit( $caps, $cap ) {
    if($cap == 'edit_plugins' )
        $caps[] = 'do_not_allow';
    return $caps;
add_filter( 'map_meta_cap', 'ra_block_tp_edit', 10, 3 );

Best of luck.

| improve this answer | |
  • If my answer worked for you, mark my answer as accepted ;) – IFightCode Apr 23 '12 at 6:34

Well, there are a few options, but, depending on the situation, code isn't the easiest way that I know to deal with this particular circumstance.

First, if your plug-in has a particular capability that is required for accessing those options, you can ensure that your users do not have that capability and write a check in your functions.php to see if user->has_cap(). It really depends on what plug-in you are using and how it's set up as to the best way to incorporate this.

Another option, if it has capabilities would be to use something like the Role Scoper Plug-in or the Members Plug-in to remove that capability through a User Interface instead of code.

Another option, if your plug-in doesn't have specific capabilities would be to set the user level to something like Editor and then use the Admin Menu Editor Plug-in to remove the settings from that user-level's admin menu.

Personally, I'd recommend the Admin Menu Editor, I use it on most of our projects to limit the user's access to various things that I don't want them to accidentally break.

I know it wasn't exactly the answer you were looking for, but if you provide some more info on that plug-in, specifically a name and a link, perhaps I can check into the best way to hook into it.

Hope this helped a little.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.