Question

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'.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top