Support » Developing with WordPress » get_users – post author dropdown on Gutenberg editor

  • The wordpress get_users function for the list of “authors” relies of “User_Level” meta data, but I understood that support for “user_level” was withdrawn in wordpress 1.5.

    Surely, the code in lines 323 to 327 should be rewritten to either:
    a) State that “authors” is the list of authors of existing posts (approach used by wp_list_authors)
    b) Be associated with the “edit_posts” capability, so that it includes the potential to associate a post with a user who has yet to write a post.

    It appears that the user_level meta data is maintained as part of updating set|add_update user_roles and only works provided a capability has been assigned one of the deprecated User_Level roles.

    • This topic was modified 1 month, 3 weeks ago by DaveWP196.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Moderator bcworkz


    The section of code you reference only applies to multisite. At line 322, $blog_id will be 0 for single site and the conditional will fail. Multisite is weird. I cannot pretend to understand why it does things. If you’re using multisite, then I cannot address your concerns about user levels.

    As far as wp_list_authors() goes, look at its own source code. The query var “who” isn’t used, so the section of code you reference isn’t applicable anyway. It’s actually getting all user IDs, then seeing which have authored actual posts and discarding all others. Lines 440-451

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.