wp_roles->role_objects ) ->filter( function ( $role ) { return $this->is_required_role( $role ); } ) ->keys() ->all(); } /** * Determine if the role can be used for a manager. * * @param \WP_Role $role The role definition. * * @return bool */ protected function is_required_role( WP_Role $role ) { return array_key_exists( 'edit_posts', $role->capabilities ); } }