[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
Mon May 27 22:57:11 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 stenaus):

 Hi

 Thanks for your input here! It helped me to resolve my issue.

 As this is not bug (I guess), because no role should be without names,
 there are two options I guess.

 1st: install WP User and Roles plugin and see what roles are not being
 used and delete them.

 2. Or go to the same file and location that you pointed out and dump all
 your roles array with

 {{{#!php
 <?php
 var_dump($this->roles);
 }}}

 just before foreach cycle.

 And then see what unused roles you have. I had the same error with bbpress
 unused roles and some very old WordPress "Administrator" (note the capital
 A) role which is not used for centuries I guess.

 For example I had to remove them manually, because bbpress plugin was not
 able to remove those roles automatically nor mentioned WP User and Roles
 plugin was not able to remove Administrator role (I guess it matches with
 the administrator syntax, but had no time to debug this one further).

 So, in my case I had to remove those roles manually:

 Go to your theme's functions.php and remove those roles manually:

 {{{#!php
 <?php
 $wp_roles = new WP_Roles();
 $wp_roles->remove_role("unused_role_goes_here");
 }}}

 After you have done refresh to your page you should not have unused roles
 anymore. Remove the PHP code from functions.php and enjoy your working WP.

 HTH.

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


More information about the wp-trac mailing list