You can use a variety of different comparison operators in meta queries, among which are 'LIKE', 'NOT LIKE', 'IN', and 'NOT IN'.

What is the difference in use between LIKE and IN?

Here’s the relevant section of the WP Query Codex page:

meta_query (array) – Custom field
parameters (3.1)

  • key (string) – Custom field key.
  • value
    (string|array) – Custom field value (Note: Array
    support is limited to a compare value of ‘IN’, ‘NOT IN’, ‘BETWEEN’, or
    ‘NOT BETWEEN’)
  • compare (string) –
    Operator to test. Possible values are ‘=’, ‘!=’, ‘>’, ‘>=’,
    ‘<‘, ‘<=’, ‘LIKE’, ‘NOT LIKE’, ‘IN’, ‘NOT IN’, ‘BETWEEN’, ‘NOT
    BETWEEN’. Default value is ‘=’.
  • type
    (string) – Custom field type. Possible values are ‘NUMERIC’,
    ‘BINARY’, ‘CHAR’, ‘DATE’, ‘DATETIME’, ‘DECIMAL’, ‘SIGNED’, ‘TIME’,
    ‘UNSIGNED’. Default value is ‘CHAR’.

2 Answers
2

Meta queries are essentially wrapper for ease of setup, but end results is part of SQL query to run on MySQL database.

These operators are those of MySQL, see in documentation:

  • LIKE operator (performs pattern matching)
  • IN() function (checks if value is in set)

Leave a Reply

Your email address will not be published. Required fields are marked *