2

Where is function.php is stored and built? I want to remove menu named as tools from mysite from all user like admin and other user's?

I Request you please help me out from this problem.Give me the best solution like lay-man to wordpress so that i can understand things quickly.

3 Answers 3

4

You want to use remove menu page.

<?php
add_action( 'admin_menu', 'wpse26980_remove_tools', 99 );
function wpse26980_remove_tools()
{
    remove_menu_page( 'tools.php' );
}

You can drop that in your functions.php file (without the opening <?php most likely).

That's not going to prevent people from typing in yoursite.com/wp-admin/tools.php and seeing the tools page, however.

0

The following code removes menus, place in your theme functions.php file:

// Remove unneeded menus
function sc_remove_menus()
{
    // setup the global menu variable
    global $menu;
    // this is an array of the menu item names we wish to remove
    $restricted = array( __('Links'),__('Tools'),__('Comments'), __('Media'));
    end ($menu);
    while (prev($menu))
    {
        $value = explode(' ',$menu[key($menu)][0]);
        if(in_array($value[0] != NULL?$value[0]:"" , $restricted))
        {
            unset($menu[key($menu)]);
        }
    }
}
// hook into the action that creates the menu
add_action('admin_menu', 'sc_remove_menus');

If you just want to remove just tools then change this line:

$restricted = array( __('Links'),__('Tools'),__('Comments'), __('Media'));

to:

$restricted = array(__('Tools'));

This will only remove the menu item. You can still get to tools by typing in the URL manually.

3
  • This code is useful . Commented Aug 27, 2011 at 3:40
  • I think this code is useful. what I also have a question that where is functions.php is stored ? I stored it in localhost/sandeep/nws/wordpress/wordpress/wp-content/themes/… it is not working sir . Commented Aug 27, 2011 at 3:53
  • I save this code like this in functions.php:-function sc_remove_menus() { // setup the global menu variable global $menu; // this is an array of the menu item names we wish to remove $restricted = array(__('Tools')); end ($menu); while (prev($menu)) { $value = explode(' ',$menu[key($menu)][0]); if(in_array($value[0] != NULL?$value[0]:"" , $restricted)) { unset($menu[key($menu)]); } } } // hook into the action that creates the menu add_action('admin_menu', 'sc_remove_menus'); Commented Aug 27, 2011 at 6:00
0

Why don't use "Admin Menu Editor" plugin to easy manager Admin-cp menu ??! Take a look on it, i'm using it for my current project, i want to say it's "perfect" !!!

http://wordpress.org/extend/plugins/admin-menu-editor/

Hope it can help you. Regards,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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