The MU forums have moved to WordPress.org

How to remove Widgets submenu (6 posts)

  1. wpnoviceuser
    Member
    Posted 16 years ago #

    How can I remove or hide the Widgets submenu from the Presentations menu in my admin panel?

    I've searched for days trying to remove this with no luck.

    I've been able to edit lots of other admin menu items by editing menu.php, but the Widgets submenu isn't there. I've used Crimson editor and searched all files in WP, but can't find where to remove this. I thought maybe it would be in widgets.php, but no luck there. I've even searched the database and can't find a field there that controls this. I can disable widgets by editing functions.php in my theme, but since I use several I really want to simply remove/hide the Widgets submenu under Presentation. I don't really mind if the widgets functionality is not disabled...just removing or hiding that submenu would be great. Any tips would be greatly appreciated.

    Thanks in advance.

  2. SteveAgl
    Member
    Posted 16 years ago #

    File wp-includes\functions.php
    From line 1416

    I use Windows Grep to search through files, it's faster it's great, you can use regular expression or not and other tons of feature, a must have tools:

    http://www.wingrep.com

  3. wpnoviceuser
    Member
    Posted 16 years ago #

    Great...thank you. And thanks for the wingrep tip.

  4. toritaiyo
    Member
    Posted 15 years ago #

    @SteveAgl

    Thanks for the Wingrep tip! I had been searching for something like this!

  5. dsader
    Member
    Posted 15 years ago #

    Mu-Plugin Option?
    add to mu-plugins

    <?php
    add_action('admin_menu', 'remove_widgets_menu_item');
    
    function remove_widgets_menu_item(){
    	global $submenu;
    	$submenu['themes.php'][7] = ''; //replace it with your own
    //	unset( $submenu['themes.php'][7] ); //remove it altogether
    }
    ?>
  6. cafespain
    Member
    Posted 15 years ago #

    Replace the lines under global $submenu; with:


    foreach($submenu['themes.php'] as $key => $sm) {
    if(__($sm[0]) == "Widgets" || $sm[2] = "widgets.php") {
    unset($submenu['themes.php'][$key];
    break;
    }
    }

    And then you will be more bullet-proof if other plugins (ahem) mess around with the admin menus before yours is run.

About this Topic

  • Started 16 years ago by wpnoviceuser
  • Latest reply from cafespain