[wp-trac] [WordPress Trac] #59011: Fatal error on single-site get_users() under certain circumstances
WordPress Trac
noreply at wordpress.org
Wed Aug 23 13:21:57 UTC 2023
#59011: Fatal error on single-site get_users() under certain circumstances
-------------------------------------------------+-------------------------
Reporter: dd32 | Owner:
| SergeyBiryukov
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 6.3.1
Component: Users | Version: 6.3
Severity: normal | Resolution: fixed
Keywords: has-patch has-unit-tests fixed- | Focuses:
major dev-reviewed commit |
-------------------------------------------------+-------------------------
Changes (by audrasjb):
* status: reopened => closed
* resolution: => fixed
Comment:
In [changeset:"56427" 56427]:
{{{
#!CommitTicketReference repository="" revision="56427"
Users: Correct the logic for `switch_to_blog()` in
`WP_User_Query::generate_cache_key()`.
If `$blog_id` equals `0`, it should be treated as the current site ID, and
there is no need to switch to a different site.
This commit prevents an unnecessary call to `switch_to_blog()` on single
site to avoid a fatal error when using `'orderby' => 'post_count'` and the
deprecated
`'who' => 'authors'` parameter:
`Uncaught Error: Call to undefined function switch_to_blog() in wp-
includes/class-wp-user-query.php:1077`
Follow-up to [55657].
Props dd32, austinginder, RavanH, mukesh27.
Reviewed by azaozz, audrasjb.
Merges [56381] to the 6.3 branch.
Fixes #59011.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59011#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list