Make WordPress Core


Ignore:
Timestamp:
11/20/2021 12:06:06 AM (5 years ago)
Author:
johnbillion
Message:

Query: Correct and standardise the meta query documentation.

Also improves the formatting of some surrounding documentation.

Props audrasjb, johnbillion

Fixes #53467

File:
1 edited

Legend:

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

    r51518 r52226  
    110110         * @since 4.8.0 Introduced the 'lang_id', 'lang__in', and 'lang__not_in' parameters.
    111111         * @since 5.1.0 Introduced the 'update_site_meta_cache', 'meta_query', 'meta_key',
    112          *              'meta_value', 'meta_type' and 'meta_compare' parameters.
     112         *              'meta_compare_key', 'meta_value', 'meta_type', and 'meta_compare' parameters.
     113         * @since 5.3.0 Introduced the 'meta_type_key' parameter.
    113114         *
    114115         * @param string|array $query {
    115116         *     Optional. Array or query string of site query parameters. Default empty.
    116117         *
    117          *     @type int[]        $site__in               Array of site IDs to include. Default empty.
    118          *     @type int[]        $site__not_in           Array of site IDs to exclude. Default empty.
    119          *     @type bool         $count                  Whether to return a site count (true) or array of site objects.
    120          *                                                Default false.
    121          *     @type array        $date_query             Date query clauses to limit sites by. See WP_Date_Query.
    122          *                                                Default null.
    123          *     @type string       $fields                 Site fields to return. Accepts 'ids' (returns an array of site IDs)
    124          *                                                or empty (returns an array of complete site objects). Default empty.
    125          *     @type int          $ID                     A site ID to only return that site. Default empty.
    126          *     @type int          $number                 Maximum number of sites to retrieve. Default 100.
    127          *     @type int          $offset                 Number of sites to offset the query. Used to build LIMIT clause.
    128          *                                                Default 0.
    129          *     @type bool         $no_found_rows          Whether to disable the `SQL_CALC_FOUND_ROWS` query. Default true.
    130          *     @type string|array $orderby                Site status or array of statuses. Accepts 'id', 'domain', 'path',
    131          *                                                'network_id', 'last_updated', 'registered', 'domain_length',
    132          *                                                'path_length', 'site__in' and 'network__in'. Also accepts false,
    133          *                                                an empty array, or 'none' to disable `ORDER BY` clause.
    134          *                                                Default 'id'.
    135          *     @type string       $order                  How to order retrieved sites. Accepts 'ASC', 'DESC'. Default 'ASC'.
    136          *     @type int          $network_id             Limit results to those affiliated with a given network ID. If 0,
    137          *                                                include all networks. Default 0.
    138          *     @type int[]        $network__in            Array of network IDs to include affiliated sites for. Default empty.
    139          *     @type int[]        $network__not_in        Array of network IDs to exclude affiliated sites for. Default empty.
    140          *     @type string       $domain                 Limit results to those affiliated with a given domain. Default empty.
    141          *     @type string[]     $domain__in             Array of domains to include affiliated sites for. Default empty.
    142          *     @type string[]     $domain__not_in         Array of domains to exclude affiliated sites for. Default empty.
    143          *     @type string       $path                   Limit results to those affiliated with a given path. Default empty.
    144          *     @type string[]     $path__in               Array of paths to include affiliated sites for. Default empty.
    145          *     @type string[]     $path__not_in           Array of paths to exclude affiliated sites for. Default empty.
    146          *     @type int          $public                 Limit results to public sites. Accepts '1' or '0'. Default empty.
    147          *     @type int          $archived               Limit results to archived sites. Accepts '1' or '0'. Default empty.
    148          *     @type int          $mature                 Limit results to mature sites. Accepts '1' or '0'. Default empty.
    149          *     @type int          $spam                   Limit results to spam sites. Accepts '1' or '0'. Default empty.
    150          *     @type int          $deleted                Limit results to deleted sites. Accepts '1' or '0'. Default empty.
    151          *     @type int          $lang_id                Limit results to a language ID. Default empty.
    152          *     @type string[]     $lang__in               Array of language IDs to include affiliated sites for. Default empty.
    153          *     @type string[]     $lang__not_in           Array of language IDs to exclude affiliated sites for. Default empty.
    154          *     @type string       $search                 Search term(s) to retrieve matching sites for. Default empty.
    155          *     @type string[]     $search_columns         Array of column names to be searched. Accepts 'domain' and 'path'.
    156          *                                                Default empty array.
    157          *     @type bool         $update_site_cache      Whether to prime the cache for found sites. Default true.
    158          *     @type bool         $update_site_meta_cache Whether to prime the metadata cache for found sites. Default true.
    159          *     @type array        $meta_query             Meta query clauses to limit retrieved sites by. See `WP_Meta_Query`.
    160          *                                                Default empty.
    161          *     @type string       $meta_key               Limit sites to those matching a specific metadata key.
    162          *                                                Can be used in conjunction with `$meta_value`. Default empty.
    163          *     @type string       $meta_value             Limit sites to those matching a specific metadata value.
    164          *                                                Usually used in conjunction with `$meta_key`. Default empty.
    165          *     @type string       $meta_type              Data type that the `$meta_value` column will be CAST to for
    166          *                                                comparisons. Default empty.
    167          *     @type string       $meta_compare           Comparison operator to test the `$meta_value`. Default empty.
     118         *     @type int[]           $site__in               Array of site IDs to include. Default empty.
     119         *     @type int[]           $site__not_in           Array of site IDs to exclude. Default empty.
     120         *     @type bool            $count                  Whether to return a site count (true) or array of site objects.
     121         *                                                   Default false.
     122         *     @type array           $date_query             Date query clauses to limit sites by. See WP_Date_Query.
     123         *                                                   Default null.
     124         *     @type string          $fields                 Site fields to return. Accepts 'ids' (returns an array of site IDs)
     125         *                                                   or empty (returns an array of complete site objects). Default empty.
     126         *     @type int             $ID                     A site ID to only return that site. Default empty.
     127         *     @type int             $number                 Maximum number of sites to retrieve. Default 100.
     128         *     @type int             $offset                 Number of sites to offset the query. Used to build LIMIT clause.
     129         *                                                   Default 0.
     130         *     @type bool            $no_found_rows          Whether to disable the `SQL_CALC_FOUND_ROWS` query. Default true.
     131         *     @type string|array    $orderby                Site status or array of statuses. Accepts:
     132         *                                                   - 'id'
     133         *                                                   - 'domain'
     134         *                                                   - 'path'
     135         *                                                   - 'network_id'
     136         *                                                   - 'last_updated'
     137         *                                                   - 'registered'
     138         *                                                   - 'domain_length'
     139         *                                                   - 'path_length'
     140         *                                                   - 'site__in'
     141         *                                                   - 'network__in'
     142         *                                                   - false, an empty array, or 'none' to disable `ORDER BY` clause.
     143         *                                                   Default 'id'.
     144         *     @type string          $order                  How to order retrieved sites. Accepts 'ASC', 'DESC'. Default 'ASC'.
     145         *     @type int             $network_id             Limit results to those affiliated with a given network ID. If 0,
     146         *                                                   include all networks. Default 0.
     147         *     @type int[]           $network__in            Array of network IDs to include affiliated sites for. Default empty.
     148         *     @type int[]           $network__not_in        Array of network IDs to exclude affiliated sites for. Default empty.
     149         *     @type string          $domain                 Limit results to those affiliated with a given domain. Default empty.
     150         *     @type string[]        $domain__in             Array of domains to include affiliated sites for. Default empty.
     151         *     @type string[]        $domain__not_in         Array of domains to exclude affiliated sites for. Default empty.
     152         *     @type string          $path                   Limit results to those affiliated with a given path. Default empty.
     153         *     @type string[]        $path__in               Array of paths to include affiliated sites for. Default empty.
     154         *     @type string[]        $path__not_in           Array of paths to exclude affiliated sites for. Default empty.
     155         *     @type int             $public                 Limit results to public sites. Accepts '1' or '0'. Default empty.
     156         *     @type int             $archived               Limit results to archived sites. Accepts '1' or '0'. Default empty.
     157         *     @type int             $mature                 Limit results to mature sites. Accepts '1' or '0'. Default empty.
     158         *     @type int             $spam                   Limit results to spam sites. Accepts '1' or '0'. Default empty.
     159         *     @type int             $deleted                Limit results to deleted sites. Accepts '1' or '0'. Default empty.
     160         *     @type int             $lang_id                Limit results to a language ID. Default empty.
     161         *     @type string[]        $lang__in               Array of language IDs to include affiliated sites for. Default empty.
     162         *     @type string[]        $lang__not_in           Array of language IDs to exclude affiliated sites for. Default empty.
     163         *     @type string          $search                 Search term(s) to retrieve matching sites for. Default empty.
     164         *     @type string[]        $search_columns         Array of column names to be searched. Accepts 'domain' and 'path'.
     165         *                                                   Default empty array.
     166         *     @type bool            $update_site_cache      Whether to prime the cache for found sites. Default true.
     167         *     @type bool            $update_site_meta_cache Whether to prime the metadata cache for found sites. Default true.
     168         *     @type string|string[] $meta_key               Meta key or keys to filter by.
     169         *     @type string|string[] $meta_value             Meta value or values to filter by.
     170         *     @type string          $meta_compare           MySQL operator used for comparing the meta value.
     171         *                                                   See WP_Meta_Query::__construct for accepted values and default value.
     172         *     @type string          $meta_compare_key       MySQL operator used for comparing the meta key.
     173         *                                                   See WP_Meta_Query::__construct for accepted values and default value.
     174         *     @type string          $meta_type              MySQL data type that the meta_value column will be CAST to for comparisons.
     175         *                                                   See WP_Meta_Query::__construct for accepted values and default value.
     176         *     @type string          $meta_type_key          MySQL data type that the meta_key column will be CAST to for comparisons.
     177         *                                                   See WP_Meta_Query::__construct for accepted values and default value.
     178         *     @type array           $meta_query             An associative array of WP_Meta_Query arguments.
     179         *                                                   See WP_Meta_Query::__construct for accepted values.
    168180         * }
    169181         */
Note: See TracChangeset for help on using the changeset viewer.