Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have two plugins in the dashboard, SEO Wordpress and Custom Content Type Manager, and for security reasons I want to hide these from dashboard. How to do that?

I tried to hide the SEO Wordpress with this:

// Remove Admin Dashboard menus
 function wp_admin_dashboard_remove_menus() {
     global $menu;
     $restricted = array(('Comments'), __('Users'), __('Updates'), __('wpseo_dashboard'));
     end ($menu);
     while (prev($menu)){
         $value = explode(' ',$menu[key($menu)][0]);
         if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){
             unset($menu[key($menu)]);
         }
     }
 }

 add_action('admin_menu', 'wp_admin_dashboard_remove_menus');

Tried many combinations like:

__('wpseo')
__('wp-seo')
__('wp_seo')

But the SEO menu did not hide.

share|improve this question
3  
Have you researched anything here? Please, tell us what you found and why it didn't work. –  brasofilo Apr 29 '13 at 15:12
2  
The WordPress Seo menu is already limited to users who can manage_options ie. admins, do you have admins who you don't want viewing/using it? I'd have a similar question for the other plugin if i could find the relevant piece of source code, but that's too many files to check via the plugin svn manually. –  t31os Apr 29 '13 at 18:24

2 Answers 2

up vote 6 down vote accepted

Wordpress SEO

If you want to remove the admin menu:

wpseo

you can do that with:

function hide_wpseo() {
       remove_action('admin_menu', 'zeo_options_menu');
}
add_action( 'init', 'hide_wpseo');

where it will be removed for all users.

WordPress SEO by Yoast

To hide the admin menu:

admin menu

and the admin menu bar:

admin menu bar

one can use:

function hide_yoastseo() {
    remove_action('admin_bar_menu', 'wpseo_admin_bar_menu',95);
    remove_menu_page('wpseo_dashboard');
}
add_action( 'admin_init', 'hide_yoastseo');

where it will be hidden for all users.

Custom Content Type Manager

Here one can hide the admin menu:

admin menu

from all users with:

function hide_cctm() {
    remove_menu_page('cctm');
}
add_action('admin_init', 'hide_cctm');
share|improve this answer
1  
It's already limited to users with manage_options, see: source here. –  t31os Apr 29 '13 at 18:25
    
@birgire i refer to Yoast WordPress SEO plugin. For the code which is above, this is not work. –  MikeD Apr 29 '13 at 18:37
1  
@t31os thanks for noticing it ;-) I updated the code to remove it for all users. –  birgire Apr 29 '13 at 19:00
1  
@MikeD I hope I got the right plugin this time ;-) –  birgire Apr 29 '13 at 19:01
2  
Unbelievable. That was three times (out of five) a slightly wrong name. Right, bilgire? Err, bitgire, no bigire. ;) Sorry, I just had to share my amazement. –  t f Apr 29 '13 at 20:50

Do you want to hide it for a specific kind of user like an author? If so, you can use the Advanced Access Manager plugin http://wordpress.org/extend/plugins/advanced-access-manager/

With this plugin you can decide what the user(group) has access to in the backend and also what permissions he/she has.

share|improve this answer
    
thanks for the answer. I want to hide it for the admin. Sorry, but i don't want to use a plugin for this. I try to solve it with a bit of code. –  MikeD Apr 29 '13 at 15:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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