Make WordPress Core

Opened 5 years ago

Last modified 5 years ago

#46035 new enhancement

Add set_display_name method to WP_Roles class

Reported by: dingo_d's profile dingo_d Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Users Keywords: needs-patch dev-feedback 2nd-opinion
Focuses: Cc:


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?

Change History (2)

#1 @pento
5 years ago

  • Version trunk deleted

#2 @dd32
5 years ago

  • Reporter changed from dingo_bastard to dingo_d
Note: See TracTickets for help on using tickets.