[wp-trac] [WordPress Trac] #60579: Notice: Undefined index: name in /wp-includes/class-wp-roles.php on line 293

WordPress Trac noreply at wordpress.org
Thu Jul 4 15:58:40 UTC 2024


#60579: Notice: Undefined index: name in /wp-includes/class-wp-roles.php  on line
293
--------------------------+------------------------------
 Reporter:  mrsize        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  6.4.3
 Severity:  minor         |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------

Comment (by mrsize):

 Thanks @stenaus,

 in addition, i have this function than can help to know whitch role has a
 name undefined :


 {{{
 function display_roles_admin_notice() {
     global $wp_roles;

     $roles_missing_names = [];
     foreach ($wp_roles->roles as $role_key => $role) {
         if (!isset($role['name'])) {
             $roles_missing_names[] = $role_key;
         }
     }

     if (!empty($roles_missing_names)) {
         $message = "Roles without names: " . implode(', ',
 $roles_missing_names);
         echo "<div class='notice notice-error'><p>{$message}</p></div>";
     }
 }

 add_action('admin_notices', 'display_roles_admin_notice');
 }}}

 i hope it can help

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60579#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list