Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#11416 closed defect (bug) (invalid)

Comments menu item cannot be removed

Reported by: shadd's profile shadd Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.8.5
Component: Administration Keywords:
Focuses: Cc:

Description

I am creating a plugin to remove some menu items from the administrator panel. It works perfectly on every menu item except the 'comments' menu item. No matter what I do, it does not disappear. Code attached:

global $menu, $submenu, $user_ID;
$the_user = new WP_User($user_ID);
reset($menu); $page = key($menu);

/*Get Menu Item*/
while (('Comments' != $menu[$page][0]) && next($menu)) {

$page = key($menu);

}

/*Unset Menu Item*/
if ('Comments' == $menu[$page][0]) {

unset($menu[$page]);

}

Change History (2)

#1 @Denis-de-Bernardy
14 years ago

  • Milestone Unassigned deleted
  • Resolution set to invalid
  • Status changed from new to closed

try unset($GLOBALSmenu?[$page]), and please take this to the wp support forum.

#2 @dd32
14 years ago

if ('Comments' == $menu[$page][0]) {

Check the contents, You'll find that 'Comments' is not the lable text.

Note: See TracTickets for help on using tickets.