Make WordPress Core


Ignore:
Timestamp:
05/19/2024 07:51:38 PM (2 months ago)
Author:
SergeyBiryukov
Message:

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 [51943].

Props kkmuffme, swissspidy, SergeyBiryukov.
See #61243.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-user-query.php

    r58045 r58172  
    143143     * @since 5.3.0 Introduced the 'meta_type_key' parameter.
    144144     * @since 5.9.0 Added 'capability', 'capability__in', and 'capability__not_in' parameters.
     145     *              Deprecated the 'who' parameter.
    145146     * @since 6.3.0 Added 'cache_results' parameter.
    146147     *
     
    152153     *
    153154     *     @type int             $blog_id             The site ID. Default is the current site.
    154      *     @type string|string[] $role                An array or a comma-separated list of role names that users must match
    155      *                                                to be included in results. Note that this is an inclusive list: users
    156      *                                                must match *each* role. Default empty.
    157      *     @type string[]        $role__in            An array of role names. Matched users must have at least one of these
    158      *                                                roles. Default empty array.
    159      *     @type string[]        $role__not_in        An array of role names to exclude. Users matching one or more of these
    160      *                                                roles will not be included in results. Default empty array.
     155     *     @type string|string[] $role                An array or a comma-separated list of role names that users
     156     *                                                must match to be included in results. Note that this is
     157     *                                                an inclusive list: users must match *each* role. Default empty.
     158     *     @type string[]        $role__in            An array of role names. Matched users must have at least one
     159     *                                                of these roles. Default empty array.
     160     *     @type string[]        $role__not_in        An array of role names to exclude. Users matching one or more
     161     *                                                of these roles will not be included in results. Default empty array.
    161162     *     @type string|string[] $meta_key            Meta key or keys to filter by.
    162163     *     @type string|string[] $meta_value          Meta value or values to filter by.
     
    171172     *     @type array           $meta_query          An associative array of WP_Meta_Query arguments.
    172173     *                                                See WP_Meta_Query::__construct() for accepted values.
    173      *     @type string|string[] $capability          An array or a comma-separated list of capability names that users must match
    174      *                                                to be included in results. Note that this is an inclusive list: users
    175      *                                                must match *each* capability.
    176      *                                                Does NOT work for capabilities not in the database or filtered via {@see 'map_meta_cap'}.
    177      *                                                Default empty.
    178      *     @type string[]        $capability__in      An array of capability names. Matched users must have at least one of these
    179      *                                                capabilities.
    180      *                                                Does NOT work for capabilities not in the database or filtered via {@see 'map_meta_cap'}.
    181      *                                                Default empty array.
    182      *     @type string[]        $capability__not_in  An array of capability names to exclude. Users matching one or more of these
    183      *                                                capabilities will not be included in results.
    184      *                                                Does NOT work for capabilities not in the database or filtered via {@see 'map_meta_cap'}.
    185      *                                                Default empty array.
     174     *     @type string|string[] $capability          An array or a comma-separated list of capability names that users
     175     *                                                must match to be included in results. Note that this is
     176     *                                                an inclusive list: users must match *each* capability.
     177     *                                                Does NOT work for capabilities not in the database or filtered
     178     *                                                via {@see 'map_meta_cap'}. Default empty.
     179     *     @type string[]        $capability__in      An array of capability names. Matched users must have at least one
     180     *                                                of these capabilities.
     181     *                                                Does NOT work for capabilities not in the database or filtered
     182     *                                                via {@see 'map_meta_cap'}. Default empty array.
     183     *     @type string[]        $capability__not_in  An array of capability names to exclude. Users matching one or more
     184     *                                                of these capabilities will not be included in results.
     185     *                                                Does NOT work for capabilities not in the database or filtered
     186     *                                                via {@see 'map_meta_cap'}. Default empty array.
    186187     *     @type int[]           $include             An array of user IDs to include. Default empty array.
    187188     *     @type int[]           $exclude             An array of user IDs to exclude. Default empty array.
     
    243244     *                                                - 'all_with_meta' Deprecated. Use 'all'.
    244245     *                                                Default 'all'.
    245      *     @type string          $who                 Type of users to query. Accepts 'authors'.
     246     *     @type string          $who                 Deprecated, use `$capability` instead.
     247     *                                                Type of users to query. Accepts 'authors'.
    246248     *                                                Default empty (all users).
    247249     *     @type bool|string[]   $has_published_posts Pass an array of post types to filter results to users who have
Note: See TracChangeset for help on using the changeset viewer.