WordPress.org

Make WordPress Core

Opened 17 months ago

Last modified 6 months ago

#43885 new enhancement

WP_Role and WP_Roles::get_role() missing Display Name

Reported by: garrett-eclipse Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Role/Capability Keywords: dev-feedback has-patch
Focuses: Cc:

Description

Hello,

While working with roles I found it odd that you can add a Display Name for a role but the WP_Role class and the WP_Roles function get_role don't provide this information.

Please add $display_name as a public attribute of WP_Role so it's available on that object and would be returned in the get_role function.

Thank you
P.S. Currently to access this information you have to use the WP_Roles as follows;

<?php
$wp_roles->roles[$role]['name'];

Attachments (1)

43885.patch (705 bytes) - added by keraweb 6 months ago.
Add $display_name property to WP_Role class

Download all attachments as: .zip

Change History (3)

@keraweb
6 months ago

Add $display_name property to WP_Role class

#1 @keraweb
6 months ago

  • Keywords dev-feedback has-patch added

#2 @keraweb
6 months ago

Similar issue with different solution: https://core.trac.wordpress.org/ticket/34608

Note: See TracTickets for help on using tickets.