| @@ -227,12 +227,17 @@ | ||
| 227 | 227 | * @param array $args Optional arguments for get_users |
| 228 | 228 | * @return array Array of user objects |
| 229 | 229 | */ |
| 230 | 230 | public static function get_users($args = array()) { |
| 231 | + // Filter at the query level instead of slicing an arbitrary first | |
| 232 | + // 100 users: on sites with more users than that, administrators past | |
| 233 | + // the cap silently disappeared from the per-user access dropdown. | |
| 234 | + // The capability argument needs WP 5.9+; the user_can() loop below | |
| 235 | + // still covers older versions. | |
| 231 | 236 | $default_args = array( |
| 232 | 237 | 'orderby' => 'display_name', |
| 233 | 238 | 'order' => 'ASC', |
| 234 | - 'number' => 100 // Limit to prevent performance issues | |
| 239 | + 'capability' => 'manage_options', | |
| 235 | 240 | ); |
| 236 | 241 | |
| 237 | 242 | $args = wp_parse_args($args, $default_args); |
| 238 | 243 | $all_users = get_users($args); |