Opened 6 years ago
Last modified 6 years ago
#46035 new enhancement
Add set_display_name method to WP_Roles class
Reported by: | dingo_d | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Users | Keywords: | needs-patch dev-feedback 2nd-opinion |
Focuses: | Cc: |
Description
Currently, people are following tutorials on line on how to 'change' the display name of certain user roles in WordPress, by basically overwriting the name property every time on either init
or admin_init
hook.
This is total overkill, and a hacky way to change the role display name (not role name which governs the capabilities stored in the database).
If there was a method set_display_name
(and a corresponding getter get_display_name
) this cosmetic change could be done only once on plugin activation - this change would then be permanent in the database and you wouldn't need to run the 'rewrite' all the time just to change name (Editor to Blog Editor for instance, or Administrator to Operations).
Only way, to do this now is to copy the entire WP_Role
object, then remove the original one, change one property and add a 'new' role.
This feels super hacky to me.
Thoughts, opinions, suggestions?