Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have made some restrictions on other user roles than the administrator. I've made it because I use WooCommerce.

I have added the following code to my themes functions.php file, and it works fine.

function remove_menus()
    global $menu;
    global $current_user;

    if($current_user->user_level < 10)
        $restricted = array(__('Pages'),
                            __('Custom Post Name'),

        end ($menu);
        while (prev($menu)){
            $value = explode(' ',$menu[key($menu)][0]);
            if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
        }// end while
    }// end if
add_action('admin_menu', 'remove_menus');

I want to hide "WooCommerce -> Settings", but I cannot figure out how to make it happen in the above code? Can someone help me?

share|improve this question
This highly depends how and where the menu is registered. You'll have to dig into WooCommerce core, file an edit and add this info to your question. – kaiser Mar 10 '14 at 12:02

1 Answer 1

Actually its very simple ex:

// only administrator
if ( ! current_user_can('manage_options') ) {
    add_action( 'admin_menu', 'remove_woocommerce_menu_pages', 999 );
    function remove_woocommerce_menu_pages() {
        remove_submenu_page('woocommerce', 'woocommerce_settings');
share|improve this answer

Your Answer


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.