[wp-trac] [WordPress Trac] #19747: Roles add_cap should call update_user_level_from_caps()

WordPress Trac noreply at wordpress.org
Tue Dec 7 11:44:50 UTC 2021


#19747: Roles add_cap should call update_user_level_from_caps()
-----------------------------+-----------------------
 Reporter:  lgladdy          |       Owner:  (none)
     Type:  defect (bug)     |      Status:  reopened
 Priority:  normal           |   Milestone:
Component:  Role/Capability  |     Version:  3.3.1
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+-----------------------
Changes (by pikamander2):

 * status:  closed => reopened
 * resolution:  duplicate =>


Comment:

 This appears to still be an issue, at least in 5.8.

 I was facing the exact same problem as @lgladdy where my custom role
 wasn't receiving the capability that I added to it via add_cap().

 His blog post (https://stormconsultancy.co.uk/blog/storm-news/custom-
 roles-in-wordpress-not-appearing-in-author-lists/) mentioned changing
 their role to something else and back as a workaround, but instead of
 trying that I just deleted the user and recreated them, at which point
 they had the new capability.

 @SergeyBiryukov @nacin - Is it possible that there was a regression here
 at some point?

 I see that 5.9 is going to be fixing a semi-related longstanding issue
 (https://core.trac.wordpress.org/ticket/16841), so I'd be curious to know
 if that happens to fix it on its own.

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


More information about the wp-trac mailing list