Scope wp_user query to specific user level#6699
Conversation
|
I can confirm this change fixes the absolutely crazy page load times on the Widgets page for a 160,000+ user WordPress site. |
|
The prior code is problematic on a number of grounds -- it has That being said, |
|
@dereksmart The other user confirms this works as well but with George's objection, sounds like you might be trying again. :/ |
|
This solution seems to work consistently. @dereksmart, @richardmtl, @georgestephanis |
| $authors = get_users( | ||
| array( | ||
| 'orderby' => 'name', | ||
| 'who' => 'authors' |
There was a problem hiding this comment.
Can we get a trailing comma here to make phpcs happy?
|
@samhotchkiss's change LGTM -- someone else needs to approve to merge since I opened this :) |
|
We'll revisit this later for avoiding |
|
If/when we revisit for scaling, we'll also want to look at this query that also uses |
* Readme: remove old release and add skeleton for 4.8. * Changelog: add #6572 * Changelog: add #6567 * Changelog: add #6542 * Changelog: add #6527 * Changelog: add #6508 * Changelog: add #6478 * Changelog: add #6477 * Changelog: add #6249 * Update stable version and remove old version from readme. * Changelog: add 4.7.1 to changelog. * Readme: add new contributor. * Sync: update docblock @SInCE version. Related: #6053 * Changelog: add release post. * changelog: add #6053 * Changelog: add #6413 * Changelog: add #6482 * Changelog: add #6584 * Changelog add #6603 * Changelog: add #6606 * Changelog: add #6611 * Changelog: add #6635 * Changelog: add #6639 * Changelog: add #6684 * Changelog: add #6710 * Changelog: add #6711 * Changelog: add #5461 * Testing list: update Settings UI feedback prompt. Props @MichaelArestad * Changelog: add #6789 * Changelog: add #6778 * Changelog: add #6777 * Changelog: add #6775 * Changelog: add #6755 * Changelog: add #6731 * Changelog: add #6721 * Changelog: add #6705 * Changelog: add #6702 * Changelog: add #6671 * Changelog: add #6637 * Changelog: add #6582 * Changelog: add #6566 * Changelog: add #6555 * Changelog: add #6529 * Changelog: add #6344 * Changelog: add #5763 * Changelog: add #5503 * Changelog: update #6637 changelog. @see 40e115c#commitcomment-21523982 * Changelog: add #6699 * Changelog: add #6632 * Changelog: add #6769 * Changelog: add #6707 * Changelog: add #6590
Fixes #6698
Scope the WP_User query to only include those with publishing abilities. Some sites were breaking since we were trying to get all subscribers as well. This will only get the users with minimum user level of 2, which grants the ability to publish posts.
https://codex.wordpress.org/User_Levels
To test:
authorsrule only lists those who can publish posts.