[wp-trac] [WordPress Trac] #65241: get_editable_roles() returns empty array in multisite

WordPress Trac noreply at wordpress.org
Fri May 15 09:50:11 UTC 2026


#65241: get_editable_roles() returns empty array in multisite
--------------------------+------------------------------
 Reporter:  neo2k23       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  close         |     Focuses:
--------------------------+------------------------------

Comment (by neo2k23):

 I want to reopen this ticket.  as i discovered the why this happened.

 Its a bug in cpanel copy when it changes the wp prefix.  It forgets to
 change the old prefix in the options_table for the multisite
 old_prefix_xx_user_roles

 f.e. in a multisite the user roles are stored in my case in
 OLDPREFIX_33_user_roles.  After the database prefix changed to NEWPREFIX
 that option should have also been changed to  NEWPREFIX_33_user_roles. but
 it remained OLDPREFIX_33_user_roles.

 Since wordpress is calling databaseprefix_site_id_user_roles where site_id
 is a number of the site in the multisite it gets a empty user role list
 calling get_editable_roles()

 **The question is why does wordpress add the site_id into the option that
 stores the user roles as they are store in the option table of the sub
 site in the multi site and not in the main option table of the first site
 in the multi_site.  It is not needed to add the site_id into that
 variable.**

 So why is the site_id number added into that variable?  Its the only
 variable in the complete options stored that has this site_id added.

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


More information about the wp-trac mailing list