[wp-trac] [WordPress Trac] #54572: Add a function for updating the existing role instead of removing, then adding one

WordPress Trac noreply at wordpress.org
Mon Oct 24 17:34:05 UTC 2022


#54572: Add a function for updating the existing role instead of removing, then
adding one
-------------------------------------------------+-------------------------
 Reporter:  maksimkuzmin                         |       Owner:
                                                 |  davidbaumwald
     Type:  enhancement                          |      Status:  reopened
 Priority:  normal                               |   Milestone:  6.1
Component:  Role/Capability                      |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests commit      |     Focuses:
  dev-reviewed                                   |
-------------------------------------------------+-------------------------

Comment (by knutsp):

 Replying to [comment:47 SergeyBiryukov]:
 > I might be missing something, but wouldn't `add_role()` work for
 updating the role without removing it first? Based on a brief reading of
 `WP_Roles::add_role()`, it seems like it should just overwrite the
 existing role definition.

 Fine. Just wanting to change the name of an existing role should have an
 inutitive name and be simple, like `update_role_name( $role )`.

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


More information about the wp-trac mailing list