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:
274functionget_editable_roles(){275$all_roles=wp_roles()->roles;276277/**278 * Filters the list of editable roles.279 *280 * @since 2.8.0281 *282 * @param array[] $all_roles Array of arrays containing role information.283 */284$editable_roles=apply_filters('editable_roles',$all_roles);285286return$editable_roles;287}
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 7.1.0 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.