all capabilities in dropdown returning boolean
-
I’m trying to put all capabilities in a dropdown menu. I can only get it to return boolean true (all 1s). If I do a vardump with $user->allcaps I get the actual names of the capabilities, but when I try to return them in the dropdown, it’s just boolean. Here’s my function:
add_shortcode('capsdropdown', 'sc_capsdropdown'); function sc_capsdropdown($attr) { $user = get_user_by('id', '1'); $capslist = $user->allcaps; $dropdown = '<select>'; foreach($capslist as $cap){ $dropdown .= '<option value="'.$cap.'">'.$cap.'</option>'; } $dropdown .= '</select>'; return $dropdown; }
I’ve tried using settype but to no avail.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘all capabilities in dropdown returning boolean’ is closed to new replies.