Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow nested meta_query with relation setting #100

Open
jasalt opened this issue Jan 5, 2025 · 0 comments
Open

Allow nested meta_query with relation setting #100

jasalt opened this issue Jan 5, 2025 · 0 comments

Comments

@jasalt
Copy link

jasalt commented Jan 5, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant