Make WordPress Core


Ignore:
Timestamp:
03/01/2018 04:02:41 AM (7 years ago)
Author:
boonebgorges
Message:

Allow LIKE queries against the 'key' value in meta queries.

The new compare_key=LIKE parameter works in conjunction with key in a
similar way to the compare=LIKE and value: by doing a "compares" LIKE
query. This allows developers to do partial matches against keys when
doing meta queries.

Props mariovalney, chasewg.
Fixes #42409.

File:
1 edited

Legend:

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

    r42581 r42768  
    605605     * @since 4.6.0 Added 'post_name__in' support for `$orderby`. Introduced the `$lazy_load_term_meta` argument.
    606606     * @since 4.9.0 Introduced the `$comment_count` parameter.
     607     * @since 5.0.0 Introduced the `$meta_compare_key` parameter.
    607608     *
    608609     * @param string|array $query {
     
    641642     *                                                 numbers 1-12. Default empty.
    642643     *     @type string       $meta_compare            Comparison operator to test the 'meta_value'.
     644     *     @type string       $meta_compare_key        Comparison operator to test the 'meta_key'.
    643645     *     @type string       $meta_key                Custom field key.
    644646     *     @type array        $meta_query              An associative array of WP_Meta_Query arguments. See WP_Meta_Query.
Note: See TracChangeset for help on using the changeset viewer.