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.

git-svn-id: https://develop.svn.wordpress.org/trunk@47616 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-04-23 18:56:40 +00:00
parent 46aad811be
commit d756c57432
1 changed files with 39 additions and 33 deletions

View File

@ -438,11 +438,6 @@ if ( isset( $_GET['updated'] ) ) {
}
?>
<h2><?php _e( 'Menu Settings' ); ?></h2>
<table id="menu" class="form-table">
<tr>
<th scope="row"><?php _e( 'Enable administration menus' ); ?></th>
<td>
<?php
$menu_perms = get_site_option( 'menu_items' );
/**
@ -462,6 +457,14 @@ if ( isset( $_GET['updated'] ) ) {
*/
$menu_items = apply_filters( 'mu_menu_items', array( 'plugins' => __( 'Plugins' ) ) );
if ( $menu_items ) :
?>
<h2><?php _e( 'Menu Settings' ); ?></h2>
<table id="menu" class="form-table">
<tr>
<th scope="row"><?php _e( 'Enable administration menus' ); ?></th>
<td>
<?php
echo '<fieldset><legend class="screen-reader-text">' . __( 'Enable menus' ) . '</legend>';
foreach ( (array) $menu_items as $key => $val ) {
@ -473,6 +476,9 @@ if ( isset( $_GET['updated'] ) ) {
</td>
</tr>
</table>
<?php
endif;
?>
<?php
/**