WordPress/wp-includes
audrasjb 82e625f72f 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.




Built from https://develop.svn.wordpress.org/branches/6.3@56427


git-svn-id: http://core.svn.wordpress.org/branches/6.3@55939 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-23 13:23:24 +00:00
..
assets Editor: update npm packages with critical bug fixes for 6.3.1. 2023-08-22 10:00:06 +00:00
block-patterns
block-supports Editor: Lazily load Duotone settings only when needed. 2023-07-13 11:34:28 +00:00
blocks Editor: update npm packages with critical bug fixes for 6.3.1. 2023-08-22 10:00:06 +00:00
certificates
css General: Commit changes after running precommit:css. 2023-08-07 17:57:27 +00:00
customize
fonts
html-api
ID3 External Libraries: Update getID3 to version 1.9.22. 2022-10-04 02:08:11 +00:00
images
IXR
js Editor: update npm packages with critical bug fixes for 6.3.1. 2023-08-22 10:00:06 +00:00
php-compat Code Modernization: Rename parameters that use reserved keywords in wp-includes/php-compat/readonly.php. 2022-12-08 19:31:17 +00:00
PHPMailer
pomo
Requests
rest-api Docs: Fix indentation issue in WP_REST_Global_Styles_Revisions_Controller class. 2023-07-21 18:45:24 +00:00
SimplePie External Libraries: Update the SimplePie library to version 1.5.7. 2021-12-20 19:33:00 +00:00
sitemaps
sodium_compat
style-engine
Text
theme-compat
widgets Docs: Replace multiple single line comments with multi-line comments. 2023-07-10 23:21:22 +00:00
admin-bar.php Help/About: Add a “Get Involved” tab to the About page. 2023-07-12 12:54:24 +00:00
atomlib.php
author-template.php Code Modernization: Correct fallback return value in get_the_author(). 2023-05-14 17:58:24 +00:00
block-editor.php
block-i18n.json
block-patterns.php
block-template-utils.php Editor: fix duplication in templates list. 2023-08-01 04:24:23 +00:00
block-template.php Toolbar: Make the 'Edit site' link open the editor with the current template. 2023-07-11 11:33:27 +00:00
blocks.php Editor: trim footnote anchors from post excerpts. 2023-07-17 01:47:26 +00:00
bookmark-template.php
bookmark.php
cache-compat.php
cache.php
canonical.php Code Modernization: Use str_contains() in a few more places. 2023-07-17 13:18:27 +00:00
capabilities.php
category-template.php
category.php
class-feed.php
class-http.php
class-IXR.php
class-json.php
class-oembed.php
class-phpass.php
class-phpmailer.php
class-pop3.php
class-requests.php
class-simplepie.php
class-smtp.php
class-snoopy.php HTTP API: Fix request header inconsistencies. 2023-02-03 13:35:20 +00:00
class-walker-category-dropdown.php
class-walker-category.php
class-walker-comment.php Docs: Increase the specificity of types in various inline documentation. 2022-01-30 19:25:03 +00:00
class-walker-nav-menu.php
class-walker-page-dropdown.php
class-walker-page.php
class-wp-admin-bar.php
class-wp-ajax-response.php
class-wp-application-passwords.php Docs: A host of corrections and improvements to inline documentation. 2023-05-08 22:37:24 +00:00
class-wp-block-editor-context.php
class-wp-block-list.php
class-wp-block-parser-block.php
class-wp-block-parser-frame.php
class-wp-block-parser.php
class-wp-block-pattern-categories-registry.php Code Modernization: Add AllowDynamicProperties attribute to all (parent) classes. 2022-09-12 15:47:14 +00:00
class-wp-block-patterns-registry.php
class-wp-block-styles-registry.php
class-wp-block-supports.php
class-wp-block-template.php
class-wp-block-type-registry.php
class-wp-block-type.php
class-wp-block.php
class-wp-classic-to-block-menu-converter.php Editor: Fix error handling of converting classic to block menus. 2023-08-22 20:59:24 +00:00
class-wp-comment-query.php
class-wp-comment.php
class-wp-customize-control.php
class-wp-customize-manager.php
class-wp-customize-nav-menus.php
class-wp-customize-panel.php
class-wp-customize-section.php
class-wp-customize-setting.php
class-wp-customize-widgets.php
class-wp-date-query.php
class-wp-dependencies.php
class-wp-dependency.php
class-wp-duotone.php Editor: Lazily load Duotone settings only when needed. 2023-07-13 11:34:28 +00:00
class-wp-editor.php Editir: Fix open_basedir warnings on the classic Edit Post screen when additional TinyMCE plugins are used. 2023-07-14 20:59:26 +00:00
class-wp-embed.php
class-wp-error.php
class-wp-fatal-error-handler.php Help/About: Use the new /documentation/ URLs for HelpHub links in WordPress Admin. 2023-02-23 10:38:21 +00:00
class-wp-feed-cache-transient.php
class-wp-feed-cache.php
class-wp-hook.php
class-wp-http-cookie.php
class-wp-http-curl.php
class-wp-http-encoding.php
class-wp-http-ixr-client.php
class-wp-http-proxy.php
class-wp-http-requests-hooks.php
class-wp-http-requests-response.php
class-wp-http-response.php
class-wp-http-streams.php
class-wp-http.php
class-wp-image-editor-gd.php Docs: Fix incorrect type for $crop param is various WP_Image_Editor classes and methods. 2023-07-11 06:31:22 +00:00
class-wp-image-editor-imagick.php Media: Stop using and deprecate set_imagick_time_limit(). Seems it causes more problems than it solves. 2023-07-17 20:04:24 +00:00
class-wp-image-editor.php Docs: Fix incorrect type for $crop param is various WP_Image_Editor classes and methods. 2023-07-11 06:31:22 +00:00
class-wp-list-util.php
class-wp-locale-switcher.php
class-wp-locale.php
class-wp-matchesmapregex.php
class-wp-meta-query.php
class-wp-metadata-lazyloader.php
class-wp-navigation-fallback.php Editor: Fix error handling of converting classic to block menus. 2023-08-22 20:59:24 +00:00
class-wp-network-query.php
class-wp-network.php Coding Standards: Use strict comparison in wp-includes/class-wp-network.php. 2023-07-12 09:46:25 +00:00
class-wp-object-cache.php
class-wp-oembed-controller.php
class-wp-oembed.php
class-wp-paused-extensions-storage.php
class-wp-post-type.php Code Modernization: Replace usage of strpos() with str_contains(). 2023-06-22 14:36:26 +00:00
class-wp-post.php
class-wp-query.php
class-wp-recovery-mode-cookie-service.php
class-wp-recovery-mode-email-service.php
class-wp-recovery-mode-key-service.php
class-wp-recovery-mode-link-service.php
class-wp-recovery-mode.php
class-wp-rewrite.php Coding Standards: Use strict comparison in wp-includes/class-wp-rewrite.php. 2023-07-11 11:35:23 +00:00
class-wp-role.php
class-wp-roles.php
class-wp-scripts.php Script Loader: Improve test coverage for wp_print_scripts(). 2023-07-17 14:05:29 +00:00
class-wp-session-tokens.php
class-wp-simplepie-file.php
class-wp-simplepie-sanitize-kses.php
class-wp-site-query.php
class-wp-site.php
class-wp-styles.php
class-wp-tax-query.php
class-wp-taxonomy.php
class-wp-term-query.php
class-wp-term.php
class-wp-text-diff-renderer-inline.php
class-wp-text-diff-renderer-table.php
class-wp-textdomain-registry.php
class-wp-theme-json-data.php
class-wp-theme-json-resolver.php
class-wp-theme-json-schema.php
class-wp-theme-json.php
class-wp-theme.php
class-wp-user-meta-session-tokens.php
class-wp-user-query.php Users: Correct the logic for switch_to_blog() in WP_User_Query::generate_cache_key(). 2023-08-23 13:23:24 +00:00
class-wp-user-request.php
class-wp-user.php
class-wp-walker.php
class-wp-widget-factory.php
class-wp-widget.php
class-wp-xmlrpc-server.php Code Modernization: Use str_contains() in a few more places. 2023-07-17 13:18:27 +00:00
class-wp.php
class-wpdb.php
class.wp-dependencies.php
class.wp-scripts.php
class.wp-styles.php
comment-template.php
comment.php
compat.php
cron.php
date.php
default-constants.php Docs: Clarify where the wp_get_development_mode() value is retrieved from. 2023-07-14 14:10:26 +00:00
default-filters.php
default-widgets.php
deprecated.php General: Rename wp_in_development_mode() to wp_is_development_mode(). 2023-07-17 14:50:21 +00:00
embed-template.php General: Use WPINC as a shorter reference to wp-includes in some files. 2022-06-17 11:20:13 +00:00
embed.php
error-protection.php Code Modernization: Replace usage of strpos() with str_starts_with(). 2023-05-02 15:45:22 +00:00
feed-atom-comments.php
feed-atom.php
feed-rdf.php
feed-rss2-comments.php
feed-rss2.php
feed-rss.php
feed.php
formatting.php Editor: trim footnote anchors from post excerpts. 2023-07-17 01:47:26 +00:00
functions.php I18n: Improve the use of dashicons-external icon for external links. 2023-07-11 12:59:25 +00:00
functions.wp-scripts.php
functions.wp-styles.php
general-template.php
global-styles-and-settings.php Editor: Fix bug where it was not possible to style custom block elements in theme.json. 2023-07-18 00:02:22 +00:00
http.php
https-detection.php
https-migration.php
kses.php
l10n.php
link-template.php Code Modernization: Use str_contains() in a few more places. 2023-07-17 13:18:27 +00:00
load.php General: Rename wp_in_development_mode() to wp_is_development_mode(). 2023-07-17 14:50:21 +00:00
locale.php
media-template.php
media.php Code Modernization: Use str_contains() in a few more places. 2023-07-17 13:18:27 +00:00
meta.php
ms-blogs.php
ms-default-constants.php
ms-default-filters.php Posts, Post Types: Pass the post object to _update_posts_count_on_delete(). 2023-02-24 01:23:20 +00:00
ms-deprecated.php
ms-files.php
ms-functions.php
ms-load.php
ms-network.php
ms-settings.php
ms-site.php
nav-menu-template.php
nav-menu.php
navigation-fallback.php Editor: load title on navigation fallback. 2023-07-25 06:35:23 +00:00
option.php
pluggable-deprecated.php
pluggable.php Code Modernization: Use str_contains() in a few more places. 2023-07-17 13:18:27 +00:00
plugin.php
post-formats.php
post-template.php Docs: Replace multiple single line comments with multi-line comments. 2023-07-10 22:48:22 +00:00
post-thumbnail-template.php
post.php
query.php
registration-functions.php
registration.php
rest-api.php
revision.php
rewrite.php Coding Standards: Use strict comparison in wp-includes/rewrite.php. 2023-07-11 11:15:27 +00:00
robots-template.php
rss-functions.php
rss.php
script-loader.php Docs: Replace multiple single line comments with multi-line comments. 2023-07-10 23:11:22 +00:00
session.php
shortcodes.php Media: Optimize images created in shortcodes. 2023-07-11 13:58:21 +00:00
sitemaps.php
spl-autoload-compat.php
style-engine.php
taxonomy.php
template-canvas.php
template-loader.php
template.php
theme-i18n.json
theme-previews.php General: Escape nonce used for block theme activation. 2023-07-12 05:21:23 +00:00
theme-templates.php
theme.json
theme.php
update.php Upgrade/Install: Pass stored credentials to WP_Filesystem() where appropriate. 2023-08-01 16:10:22 +00:00
user.php
vars.php General: Update Opera browser sniff follow UA string changes. 2023-07-13 00:58:25 +00:00
version.php Users: Correct the logic for switch_to_blog() in WP_User_Query::generate_cache_key(). 2023-08-23 13:23:24 +00:00
widgets.php
wp-db.php
wp-diff.php