• Resolved May_68

    (@may_68)


    Hello , I am just finishing off a site for a client and I was editing the role capabilites and cleaning up the menu. I have a made a child theme for twenty twelve and manage to remove all the menus and submenus i needed from the editor role. But been having problems to remove the:

    • Apearence>Theme options,
    • Apperance>Header
    • and Appearence >Background

    .

    Initialy i used the :

    // Edit Editor User Roles
    function add_theme_caps() {
    
      $role = get_role( 'editor' ); // ou subscriber, nao sei que role tem o cliente
      $role->add_cap('edit_theme_options' );
      $role->add_cap('moderate_comments' );
    }

    then after couldnt really get to the submenu items that way so i used the following method .

    function my_remove_menu_pages() {
    	if(!current_user_can('add_users')) {
    		remove_menu_page('options-general.php'); // Settings
    		remove_menu_page('link-manager.php'); // Links
    		remove_menu_page('tools.php'); // Tools
    		remove_menu_page('edit-comments.php'); //comments
    		remove_submenu_page( 'edit.php', 'edit-tags.php?taxonomy=post_tag' ); // Post tags
    
    		remove_submenu_page ('themes.php', 'themes.php');
    		remove_submenu_page( 'themes.php', 'themes.php?page=options-framework');
    		remove_submenu_page( 'themes.php', 'themes.php?page=options_framework' );
    		remove_submenu_page( 'themes.php', 'themes.php?' );
    		remove_submenu_page( 'themes.php', 'themes.php?page=costum_background' ); 
    
    		//unset($submenu['themes.php'][5]); // Removes 'Themes'.
    
    	}
    }
    add_action( 'admin_init', 'my_remove_menu_pages' );

    All seems to work fine except the the remove os those last three items.
    In the bottom i have commented another way to do the same thing but not really sure who is who with the number system.

    Can any one helpme with this ?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘{wp-core}{Thme:Twenty Twelve } Remove Admin Submenu items’ is closed to new replies.