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

Accept named meta_query clauses #3469

Merged
merged 4 commits into from
May 23, 2023
Merged

Accept named meta_query clauses #3469

merged 4 commits into from
May 23, 2023

Conversation

felipeelia
Copy link
Member

@felipeelia felipeelia commented May 22, 2023

Description of the Change

This PR introduces the ability to sort queries by named clauses in the meta_query argument and also adds support to sort by different meta types.

Closes #3369
Closes #3326

How to test the Change

Run the following query and see it working instead of throwing the No mapping found for [named_meta_query_key] in order to sort on error.

$args = array(
	'ep_integrate' => true,
	'fields'       => 'ids',
	'meta_query'   => [
		'named_clause' => [
			'key'     => 'test_key',
			'compare' => 'EXISTS',
		],
	],
	'orderby'      => 'named_clause',
);
$query = new \WP_Query( $args );

Changelog Entry

Added - Sort meta queries by named clauses and sort by different meta types.

Credits

Props @felipeelia @selim13

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@felipeelia felipeelia added this to the 4.6.0 milestone May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants