How can I modify users.php and edit.php to not query & load all users?

We have 125,000 members and are growing rapidly. When our authors & editors go to review posts, we are getting 504 errors because edit.php calls wp_list_table which calls _get_list_table('wp_posts_list_table') to get all members and displays them in a dropdown of authors. Only a few members (<100 editors&admin) need to be in the list even though we allow all members to post.

users.php does the same to re-assign posts when deleting a member. The same list works here.
Thanks,
Boyd

  • Alexander

    Hi @vivinow,

    I've taken a look at this, and there isn't a way we can work this out without modifying core WordPress files, which I really wouldn't recommend. It's still a possibility, but maybe we can find an alternate solution

    How many users of the author and admin role do you have? Are we talking hundreds or thousands?

    Could you use a plugin like PermitPress to create additional roles? Then you could have a custom author roles that would have the correct privileges, but not end up being queried as it's not a true "author" role.

  • vivinow

    Thanks for the response and I would like to avoid modifying core WP files if possible.

    The requested answers are as follows:

    All members start as contributors and can post a draft.

    Only authors and editors can approve and publish them. Authors & editors & admin are about 10 today and probably would never be more than 100.

    How can roles can help because edit.php goes after all of our members and so does users.php?

    Thanks,
    Boyd

  • Alexander

    Hi @vivinow,

    I'm sorry about the delay here. It sounds like because everyone is a contributor, they are all being added to that list. By making everyone a custom role (not a contributor) you'd avoid having everyone populated into that list.

    WordPress would look for contributors, editors, and admins, but only find a small amount.

    Then your custom role could still have similar permissions to a contributor. They just wouldn't be included in the query from that function.

    If you still want to modify core directly. This is an option. But I don't recommend doing it. Do you know the exact place in code where this is failing? Enabling WP_DEBUG can help you find out exactly where the problem occurs.

    Best regards,