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-meta-query.php

    r51797 r52226  
    100100         * @since 3.2.0
    101101         * @since 4.2.0 Introduced support for naming query clauses by associative array keys.
    102          * @since 5.1.0 Introduced $compare_key clause parameter, which enables LIKE key matches.
    103          * @since 5.3.0 Increased the number of operators available to $compare_key. Introduced $type_key,
    104          *              which enables the $key to be cast to a new data type for comparisons.
     102         * @since 5.1.0 Introduced `$compare_key` clause parameter, which enables LIKE key matches.
     103         * @since 5.3.0 Increased the number of operators available to `$compare_key`. Introduced `$type_key`,
     104         *              which enables the `$key` to be cast to a new data type for comparisons.
    105105         *
    106106         * @param array $meta_query {
    … …  
    108108         *     their array keys, they may be referenced in the 'orderby' parameter of the parent query.
    109109         *
    110          *     @type string $relation Optional. The MySQL keyword used to join
    111          *                            the clauses of the query. Accepts 'AND', or 'OR'. Default 'AND'.
     110         *     @type string $relation Optional. The MySQL keyword used to join the clauses of the query.
     111         *                            Accepts 'AND' or 'OR'. Default 'AND'.
    112112         *     @type array  ...$0 {
    113113         *         Optional. An array of first-order clause parameters, or another fully-formed meta query.
    114114         *
    115          *         @type string $key         Meta key to filter by.
    116          *         @type string $compare_key MySQL operator used for comparing the $key. Accepts '=', '!='
    117          *                                   'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'REGEXP', 'NOT REGEXP', 'RLIKE',
    118          *                                   'EXISTS' (alias of '=') or 'NOT EXISTS' (alias of '!=').
    119          *                                   Default is 'IN' when `$key` is an array, '=' otherwise.
    120          *         @type string $type_key    MySQL data type that the meta_key column will be CAST to for
    121          *                                   comparisons. Accepts 'BINARY' for case-sensitive regular expression
    122          *                                   comparisons. Default is ''.
    123          *         @type string $value       Meta value to filter by.
    124          *         @type string $compare     MySQL operator used for comparing the $value. Accepts '=',
    125          *                                   '!=', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE',
    126          *                                   'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN', 'REGEXP',
    127          *                                   'NOT REGEXP', 'RLIKE', 'EXISTS' or 'NOT EXISTS'.
    128          *                                   Default is 'IN' when `$value` is an array, '=' otherwise.
    129          *         @type string $type        MySQL data type that the meta_value column will be CAST to for
    130          *                                   comparisons. Accepts 'NUMERIC', 'BINARY', 'CHAR', 'DATE',
    131          *                                   'DATETIME', 'DECIMAL', 'SIGNED', 'TIME', or 'UNSIGNED'.
    132          *                                   Default is 'CHAR'.
     115         *         @type string|string[] $key         Meta key or keys to filter by.
     116         *         @type string          $compare_key MySQL operator used for comparing the $key. Accepts:
     117         *                                            - '='
     118         *                                            - '!='
     119         *                                            - 'LIKE'
     120         *                                            - 'NOT LIKE'
     121         *                                            - 'IN'
     122         *                                            - 'NOT IN'
     123         *                                            - 'REGEXP'
     124         *                                            - 'NOT REGEXP'
     125         *                                            - 'RLIKE',
     126         *                                            - 'EXISTS' (alias of '=')
     127         *                                            - 'NOT EXISTS' (alias of '!=')
     128         *                                            Default is 'IN' when `$key` is an array, '=' otherwise.
     129         *         @type string          $type_key    MySQL data type that the meta_key column will be CAST to for
     130         *                                            comparisons. Accepts 'BINARY' for case-sensitive regular expression
     131         *                                            comparisons. Default is ''.
     132         *         @type string|string[] $value       Meta value or values to filter by.
     133         *         @type string          $compare     MySQL operator used for comparing the $value. Accepts:
     134         *                                            - '=',
     135         *                                            - '!='
     136         *                                            - '>'
     137         *                                            - '>='
     138         *                                            - '<'
     139         *                                            - '<='
     140         *                                            - 'LIKE'
     141         *                                            - 'NOT LIKE'
     142         *                                            - 'IN'
     143         *                                            - 'NOT IN'
     144         *                                            - 'BETWEEN'
     145         *                                            - 'NOT BETWEEN'
     146         *                                            - 'REGEXP'
     147         *                                            - 'NOT REGEXP'
     148         *                                            - 'RLIKE'
     149         *                                            - 'EXISTS'
     150         *                                            - 'NOT EXISTS'
     151         *                                            Default is 'IN' when `$value` is an array, '=' otherwise.
     152         *         @type string          $type        MySQL data type that the meta_value column will be CAST to for
     153         *                                            comparisons. Accepts:
     154         *                                            - 'NUMERIC'
     155         *                                            - 'BINARY'
     156         *                                            - 'CHAR'
     157         *                                            - 'DATE'
     158         *                                            - 'DATETIME'
     159         *                                            - 'DECIMAL'
     160         *                                            - 'SIGNED'
     161         *                                            - 'TIME'
     162         *                                            - 'UNSIGNED'
     163         *                                            Default is 'CHAR'.
    133164         *     }
    134165         * }
Note: See TracChangeset for help on using the changeset viewer.