WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#11416 closed defect (bug) (invalid)

Comments menu item cannot be removed

Reported by: 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)

comment:1 Denis-de-Bernardy4 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.

comment:2 dd324 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.