General Relation Meta 1 Meta 2 Meta 3 Meta 4 Meta 5 Overview Use this tool to create custom code for WordPress Meta Query with WP_Meta_Query class. Usage Fill in the user-friendly form. Click the “Update Code” button. Copy the code to your project. Or save it as a snippet and share with the community. Examples If you are still learning how to use this tool, check out the following examples: Single meta parameter Multiple meta parameters Nested meta parameters Query Variable Name The variable used in the code. Meta Relation Choose... AND (default) OR The MySQL keyword used to join the clauses of the query. Meta Type Meta Parameters Nested Meta Query Key Meta key to filter by. Compare Choose... = (Default) != > >= < <= LIKE NOT LIKE IN NOT IN BETWEEN NOT BETWEEN EXISTS NOT EXISTS REGEXP NOT REGEXP RLIKE Operator used for comparing the value. Meta Query No save snippets... Select from your saved Meta Query snippets. Value Meta value to filter by. Type Choose... NUMERIC BINARY DATE CHAR (Default) DATETIME DECIMAL SIGNED TIME UNSIGNED Meta value type. Meta Type Meta Parameters Nested Meta Query Key Meta key to filter by. Compare Choose... = (Default) != > >= < <= LIKE NOT LIKE IN NOT IN BETWEEN NOT BETWEEN EXISTS NOT EXISTS REGEXP NOT REGEXP RLIKE Operator used for comparing the value. Meta Query No save snippets... Select from your saved Meta Query snippets. Value Meta value to filter by. Type Choose... NUMERIC BINARY DATE CHAR (Default) DATETIME DECIMAL SIGNED TIME UNSIGNED Meta value type. Meta Type Meta Parameters Nested Meta Query Key Meta key to filter by. Compare Choose... = (Default) != > >= < <= LIKE NOT LIKE IN NOT IN BETWEEN NOT BETWEEN EXISTS NOT EXISTS REGEXP NOT REGEXP RLIKE Operator used for comparing the value. Meta Query No save snippets... Select from your saved Meta Query snippets. Value Meta value to filter by. Type Choose... NUMERIC BINARY DATE CHAR (Default) DATETIME DECIMAL SIGNED TIME UNSIGNED Meta value type. Meta Type Meta Parameters Nested Meta Query Key Meta key to filter by. Compare Choose... = (Default) != > >= < <= LIKE NOT LIKE IN NOT IN BETWEEN NOT BETWEEN EXISTS NOT EXISTS REGEXP NOT REGEXP RLIKE Operator used for comparing the value. Meta Query No save snippets... Select from your saved Meta Query snippets. Value Meta value to filter by. Type Choose... NUMERIC BINARY DATE CHAR (Default) DATETIME DECIMAL SIGNED TIME UNSIGNED Meta value type. Meta Type Meta Parameters Nested Meta Query Key Meta key to filter by. Compare Choose... = (Default) != > >= < <= LIKE NOT LIKE IN NOT IN BETWEEN NOT BETWEEN EXISTS NOT EXISTS REGEXP NOT REGEXP RLIKE Operator used for comparing the value. Meta Query No save snippets... Select from your saved Meta Query snippets. Value Meta value to filter by. Type Choose... NUMERIC BINARY DATE CHAR (Default) DATETIME DECIMAL SIGNED TIME UNSIGNED Meta value type. Update Code Save Snippet
$meta_query = array( 'relation' => 'OR', array( 'key' => 'color', 'value' => 'blue', 'compare' => '=', ), array( 'key' => 'color', 'value' => 'red', 'compare' => '=', ), );