Fetch a filtered list of user roles that the current user is allowed to edit.
Description
Simple function whose main purpose is to allow filtering of the list of roles in the $wp_roles object so that plugins can remove inappropriate ones depending on the situation or user making edits.Specifically because without filtering anyone with the edit_users capability can edit others to be administrators, even if they are only editors or authors. This filter allows admins to delegate user management.
Return
array[]
Array of arrays containing role information.
Hooks fired · 1
One hook fires while get_editable_roles() runs, in this order:
273functionget_editable_roles(){274$all_roles=wp_roles()->roles;275276/**277 * Filters the list of editable roles.278 *279 * @since 2.8.0280 *281 * @param array[] $all_roles Array of arrays containing role information.282 */283$editable_roles=apply_filters('editable_roles',$all_roles);284285return$editable_roles;286}
History
Introduced in 2.8.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-admin/includes/user.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.