<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[58172] trunk/src/wp-includes: Docs: Add a note that the `who` parameter in `WP_User_Query` is deprecated.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/58172">58172</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/58172","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2024-05-19 19:51:38 +0000 (Sun, 19 May 2024)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Docs: Add a note that the `who` parameter in `WP_User_Query` is deprecated.
Any usage of `'who' => 'authors'` should be updated to use capability queries instead.
Includes documenting the capability query parameters in `wp_dropdown_users()`.
Follow-up to <a href="https://core.trac.wordpress.org/changeset/51943">[51943]</a>.
Props kkmuffme, swissspidy, SergeyBiryukov.
See <a href="https://core.trac.wordpress.org/ticket/61243">#61243</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesclasswpuserqueryphp">trunk/src/wp-includes/class-wp-user-query.php</a></li>
<li><a href="#trunksrcwpincludesuserphp">trunk/src/wp-includes/user.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesclasswpuserqueryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-user-query.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-user-query.php 2024-05-18 23:16:09 UTC (rev 58171)
+++ trunk/src/wp-includes/class-wp-user-query.php 2024-05-19 19:51:38 UTC (rev 58172)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -142,6 +142,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.1.0 Introduced the 'meta_compare_key' parameter.
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.3.0 Introduced the 'meta_type_key' parameter.
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.9.0 Added 'capability', 'capability__in', and 'capability__not_in' parameters.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Deprecated the 'who' parameter.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @since 6.3.0 Added 'cache_results' parameter.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global wpdb $wpdb WordPress database abstraction object.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -151,13 +152,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Optional. Array or string of query parameters.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @type int $blog_id The site ID. Default is the current site.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @type string|string[] $role An array or a comma-separated list of role names that users must match
- * to be included in results. Note that this is an inclusive list: users
- * must match *each* role. Default empty.
- * @type string[] $role__in An array of role names. Matched users must have at least one of these
- * roles. Default empty array.
- * @type string[] $role__not_in An array of role names to exclude. Users matching one or more of these
- * roles will not be included in results. Default empty array.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @type string|string[] $role An array or a comma-separated list of role names that users
+ * must match to be included in results. Note that this is
+ * an inclusive list: users must match *each* role. Default empty.
+ * @type string[] $role__in An array of role names. Matched users must have at least one
+ * of these roles. Default empty array.
+ * @type string[] $role__not_in An array of role names to exclude. Users matching one or more
+ * of these roles will not be included in results. Default empty array.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @type string|string[] $meta_key Meta key or keys to filter by.
</span><span class="cx" style="display: block; padding: 0 10px"> * @type string|string[] $meta_value Meta value or values to filter by.
</span><span class="cx" style="display: block; padding: 0 10px"> * @type string $meta_compare MySQL operator used for comparing the meta value.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -170,19 +171,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * See WP_Meta_Query::__construct() for accepted values and default value.
</span><span class="cx" style="display: block; padding: 0 10px"> * @type array $meta_query An associative array of WP_Meta_Query arguments.
</span><span class="cx" style="display: block; padding: 0 10px"> * See WP_Meta_Query::__construct() for accepted values.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @type string|string[] $capability An array or a comma-separated list of capability names that users must match
- * to be included in results. Note that this is an inclusive list: users
- * must match *each* capability.
- * Does NOT work for capabilities not in the database or filtered via {@see 'map_meta_cap'}.
- * Default empty.
- * @type string[] $capability__in An array of capability names. Matched users must have at least one of these
- * capabilities.
- * Does NOT work for capabilities not in the database or filtered via {@see 'map_meta_cap'}.
- * Default empty array.
- * @type string[] $capability__not_in An array of capability names to exclude. Users matching one or more of these
- * capabilities will not be included in results.
- * Does NOT work for capabilities not in the database or filtered via {@see 'map_meta_cap'}.
- * Default empty array.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @type string|string[] $capability An array or a comma-separated list of capability names that users
+ * must match to be included in results. Note that this is
+ * an inclusive list: users must match *each* capability.
+ * Does NOT work for capabilities not in the database or filtered
+ * via {@see 'map_meta_cap'}. Default empty.
+ * @type string[] $capability__in An array of capability names. Matched users must have at least one
+ * of these capabilities.
+ * Does NOT work for capabilities not in the database or filtered
+ * via {@see 'map_meta_cap'}. Default empty array.
+ * @type string[] $capability__not_in An array of capability names to exclude. Users matching one or more
+ * of these capabilities will not be included in results.
+ * Does NOT work for capabilities not in the database or filtered
+ * via {@see 'map_meta_cap'}. Default empty array.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @type int[] $include An array of user IDs to include. Default empty array.
</span><span class="cx" style="display: block; padding: 0 10px"> * @type int[] $exclude An array of user IDs to exclude. Default empty array.
</span><span class="cx" style="display: block; padding: 0 10px"> * @type string $search Search keyword. Searches for possible string matches on columns.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -242,7 +243,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * - 'all' for all fields and loads user meta.
</span><span class="cx" style="display: block; padding: 0 10px"> * - 'all_with_meta' Deprecated. Use 'all'.
</span><span class="cx" style="display: block; padding: 0 10px"> * Default 'all'.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @type string $who Type of users to query. Accepts 'authors'.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @type string $who Deprecated, use `$capability` instead.
+ * Type of users to query. Accepts 'authors'.
</ins><span class="cx" style="display: block; padding: 0 10px"> * Default empty (all users).
</span><span class="cx" style="display: block; padding: 0 10px"> * @type bool|string[] $has_published_posts Pass an array of post types to filter results to users who have
</span><span class="cx" style="display: block; padding: 0 10px"> * published posts in those post types. `true` is an alias for all
</span></span></pre></div>
<a id="trunksrcwpincludesuserphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/user.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/user.php 2024-05-18 23:16:09 UTC (rev 58171)
+++ trunk/src/wp-includes/user.php 2024-05-19 19:51:38 UTC (rev 58172)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1540,54 +1540,70 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.3.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.5.0 Added the 'display_name_with_login' value for 'show'.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 4.7.0 Added the `$role`, `$role__in`, and `$role__not_in` parameters.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 4.7.0 Added the 'role', 'role__in', and 'role__not_in' parameters.
+ * @since 5.9.0 Added the 'capability', 'capability__in', and 'capability__not_in' parameters.
+ * Deprecated the 'who' parameter.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array|string $args {
</span><span class="cx" style="display: block; padding: 0 10px"> * Optional. Array or string of arguments to generate a drop-down of users.
</span><span class="cx" style="display: block; padding: 0 10px"> * See WP_User_Query::prepare_query() for additional available arguments.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @type string $show_option_all Text to show as the drop-down default (all).
- * Default empty.
- * @type string $show_option_none Text to show as the drop-down default when no
- * users were found. Default empty.
- * @type int|string $option_none_value Value to use for $show_option_none when no users
- * were found. Default -1.
- * @type string $hide_if_only_one_author Whether to skip generating the drop-down
- * if only one user was found. Default empty.
- * @type string $orderby Field to order found users by. Accepts user fields.
- * Default 'display_name'.
- * @type string $order Whether to order users in ascending or descending
- * order. Accepts 'ASC' (ascending) or 'DESC' (descending).
- * Default 'ASC'.
- * @type int[]|string $include Array or comma-separated list of user IDs to include.
- * Default empty.
- * @type int[]|string $exclude Array or comma-separated list of user IDs to exclude.
- * Default empty.
- * @type bool|int $multi Whether to skip the ID attribute on the 'select' element.
- * Accepts 1|true or 0|false. Default 0|false.
- * @type string $show User data to display. If the selected item is empty
- * then the 'user_login' will be displayed in parentheses.
- * Accepts any user field, or 'display_name_with_login' to show
- * the display name with user_login in parentheses.
- * Default 'display_name'.
- * @type int|bool $echo Whether to echo or return the drop-down. Accepts 1|true (echo)
- * or 0|false (return). Default 1|true.
- * @type int $selected Which user ID should be selected. Default 0.
- * @type bool $include_selected Whether to always include the selected user ID in the drop-
- * down. Default false.
- * @type string $name Name attribute of select element. Default 'user'.
- * @type string $id ID attribute of the select element. Default is the value of $name.
- * @type string $class Class attribute of the select element. Default empty.
- * @type int $blog_id ID of blog (Multisite only). Default is ID of the current blog.
- * @type string $who Which type of users to query. Accepts only an empty string or
- * 'authors'. Default empty.
- * @type string|array $role An array or a comma-separated list of role names that users must
- * match to be included in results. Note that this is an inclusive
- * list: users must match *each* role. Default empty.
- * @type string[] $role__in An array of role names. Matched users must have at least one of
- * these roles. Default empty array.
- * @type string[] $role__not_in An array of role names to exclude. Users matching one or more of
- * these roles will not be included in results. Default empty array.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @type string $show_option_all Text to show as the drop-down default (all).
+ * Default empty.
+ * @type string $show_option_none Text to show as the drop-down default when no
+ * users were found. Default empty.
+ * @type int|string $option_none_value Value to use for `$show_option_none` when no users
+ * were found. Default -1.
+ * @type string $hide_if_only_one_author Whether to skip generating the drop-down
+ * if only one user was found. Default empty.
+ * @type string $orderby Field to order found users by. Accepts user fields.
+ * Default 'display_name'.
+ * @type string $order Whether to order users in ascending or descending
+ * order. Accepts 'ASC' (ascending) or 'DESC' (descending).
+ * Default 'ASC'.
+ * @type int[]|string $include Array or comma-separated list of user IDs to include.
+ * Default empty.
+ * @type int[]|string $exclude Array or comma-separated list of user IDs to exclude.
+ * Default empty.
+ * @type bool|int $multi Whether to skip the ID attribute on the 'select' element.
+ * Accepts 1|true or 0|false. Default 0|false.
+ * @type string $show User data to display. If the selected item is empty
+ * then the 'user_login' will be displayed in parentheses.
+ * Accepts any user field, or 'display_name_with_login' to show
+ * the display name with user_login in parentheses.
+ * Default 'display_name'.
+ * @type int|bool $echo Whether to echo or return the drop-down. Accepts 1|true (echo)
+ * or 0|false (return). Default 1|true.
+ * @type int $selected Which user ID should be selected. Default 0.
+ * @type bool $include_selected Whether to always include the selected user ID in the drop-
+ * down. Default false.
+ * @type string $name Name attribute of select element. Default 'user'.
+ * @type string $id ID attribute of the select element. Default is the value of `$name`.
+ * @type string $class Class attribute of the select element. Default empty.
+ * @type int $blog_id ID of blog (Multisite only). Default is ID of the current blog.
+ * @type string $who Deprecated, use `$capability` instead.
+ * Which type of users to query. Accepts only an empty string or
+ * 'authors'. Default empty (all users).
+ * @type string|string[] $role An array or a comma-separated list of role names that users
+ * must match to be included in results. Note that this is
+ * an inclusive list: users must match *each* role. Default empty.
+ * @type string[] $role__in An array of role names. Matched users must have at least one
+ * of these roles. Default empty array.
+ * @type string[] $role__not_in An array of role names to exclude. Users matching one or more
+ * of these roles will not be included in results. Default empty array.
+ * @type string|string[] $capability An array or a comma-separated list of capability names that users
+ * must match to be included in results. Note that this is
+ * an inclusive list: users must match *each* capability.
+ * Does NOT work for capabilities not in the database or filtered
+ * via {@see 'map_meta_cap'}. Default empty.
+ * @type string[] $capability__in An array of capability names. Matched users must have at least one
+ * of these capabilities.
+ * Does NOT work for capabilities not in the database or filtered
+ * via {@see 'map_meta_cap'}. Default empty array.
+ * @type string[] $capability__not_in An array of capability names to exclude. Users matching one or more
+ * of these capabilities will not be included in results.
+ * Does NOT work for capabilities not in the database or filtered
+ * via {@see 'map_meta_cap'}. Default empty array.
</ins><span class="cx" style="display: block; padding: 0 10px"> * }
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string HTML dropdown list of users.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span></span></pre>
</div>
</div>
</body>
</html>