Skip to content

Allow nested meta_query with relation setting #100

Description

@jasalt

Example WP_Query args that is not possible to achieve in the current block UI:

[
'post_type' => ['post', 'event'],
'meta_query' => [
	'relation' => 'AND',
	[
		'key' => 'crb_pinned_enabled',
		'value' => 'yes'  // boolean
	],
	[
		'relation' => 'OR',  // <- nested OR relation is not possible to set
		[
			'key' => 'crb_pinned_until',
			'value' => '',  // date, when field not set, keep pinned forever
			'compare' => '='
		],
		[
			'key' => 'crb_pinned_until',
			'value' => date('Y-m-d'), // today's not included
			'compare' => '>',
			'type' => 'DATETIME'
		]
	]
],
]

Allowing even one extra meta query level in UI would probably help in many cases without being too crazy to implement. Compare type used in example is also impossible but created another issue for it #99.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions