WordPress.org

Make WordPress Core

#49977 closed defect (bug) (fixed)

Multisite: 'mu_menu_items' filter leaves empty table on Network Settings

Reported by: dlh Owned by: SergeyBiryukov
Milestone: 5.5 Priority: normal
Severity: normal Version: 3.0
Component: Networks and Sites Keywords: has-patch has-screenshots
Focuses: multisite Cc:

Description

As a developer maintaining a multisite network, I'd like to prevent super administrators from enabling any administration menus on individual sites, such as "Plugins." I can do this with:

add_filter( 'mu_menu_items', '__return_empty_array' );

However, the Menu Settings heading and empty settings table still appear on the Network Settings screen. See the attached screenshot.

The attached patch would check for available menus after applying mu_menu_items and before rendering the markup.

Attachments (2)

49977.diff (3.3 KB) - added by dlh 20 months ago.
Screen Shot 2020-04-22 at 2.41.42 PM.png (49.1 KB) - added by dlh 20 months ago.

Download all attachments as: .zip

Change History (4)

@dlh
20 months ago

#1 @SergeyBiryukov
20 months ago

  • Milestone changed from Awaiting Review to 5.5

#2 @SergeyBiryukov
20 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 47616:

Networks and Sites: Don't display an empty Menu Settings section in network admin if there are no items.

This accounts for returning an empty array from the mu_menu_items filter.

Props dlh.
Fixes #49977.

Note: See TracTickets for help on using tickets.