[wp-trac] [WordPress Trac] #59011: Fatal error on single-site get_users() under certain circumstances
WordPress Trac
noreply at wordpress.org
Thu Aug 10 10:24:44 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 | Focuses:
--------------------------------------+-----------------------------
Changes (by SergeyBiryukov):
* owner: (none) => SergeyBiryukov
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"56381" 56381]:
{{{
#!CommitTicketReference repository="" revision="56381"
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.
Fixes #59011.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59011#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list