Skip to content

Commit d47c0bf

Browse files
committed
Fix PHP Notice: Undefined offset: 0 in class-wpum-menus.php
1 parent 07939bd commit d47c0bf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

includes/wpum-admin/class-wpum-menus.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,9 @@ public function exclude_menu_items( $items, $menu, $args ) {
164164
$visible = is_user_logged_in() ? true : false;
165165
if ( is_array( $roles ) && ! empty( $roles ) && is_user_logged_in() ) {
166166
$user = wp_get_current_user();
167-
$role = (array) $user->roles;
168-
$current_role = $role[0];
167+
$roles = (array) $user->roles;
168+
$roles = array_values( $roles );
169+
$current_role = $roles[0];
169170

170171
if ( ! array_intersect( (array) $user->roles, $roles ) ) {
171172
$visible = false;

0 commit comments

Comments
 (0)