WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/19/2019 03:02:20 PM (2 years ago)
Author:
boonebgorges
Message:

Query: Expand the list of operators available to compare_key in WP_Meta_Query.

compare_key, introduced in #42409, previously supported only = and LIKE
operators. This changeset introduces a number of other operators: !=, IN,
NOT IN, NOT LIKE, RLIKE, REGEXP, NOT REGEXP, EXISTS, and NOT EXISTS
(the latter two aliased to = and !=, respectively). To support case-sensitive
regular expression key comparisons, the new type_key parameter will force
a MySQL CAST when 'BINARY' is passed.

Props soulseekah.
Fixes #43346.

File:
1 edited

Legend:

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

    r46144 r46188  
    615615     * @since 4.9.0 Introduced the `$comment_count` parameter.
    616616     * @since 5.1.0 Introduced the `$meta_compare_key` parameter.
     617     * @since 5.3.0 Introduced the `$meta_type_key` parameter.
    617618     *
    618619     * @param string|array $query {
     
    656657     *     @type string       $meta_value              Custom field value.
    657658     *     @type int          $meta_value_num          Custom field value number.
     659     *     @type string       $meta_type_key           Cast for 'meta_key'. See WP_Meta_Query::construct().
    658660     *     @type int          $menu_order              The menu order of the posts.
    659661     *     @type int          $monthnum                The two-digit month. Default empty. Accepts numbers 1-12.
Note: See TracChangeset for help on using the changeset viewer.