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

Add support to 'NOT LIKE' operator for meta_query #2157

Merged
merged 2 commits into from
Apr 16, 2021

Conversation

Rahmon
Copy link
Contributor

@Rahmon Rahmon commented Apr 5, 2021

Description of the Change

This change adds support to NOT LIKE operator for meta_query.

Alternate Designs

Benefits

Adds a new way to filter posts.

Possible Drawbacks

Verification Process

This has been tested manually adding a custom field using ACF and querying with the operator NOT LIKE.

  1. Adds a check box field with the options red, green, and blue;
  2. Set this field in some posts;
  3. Query using NOT LIKE
$args = array(
	'ep_integrate' => true,
	'meta_query'   => array(
		array(
			'key'     => 'checks',
			'value'   => 'red',
			'compare' => 'NOT LIKE',
		),
	),
);

$the_query = new WP_Query( $args );

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Applicable Issues

Closes: #2015

Changelog Entry

Added support to NOT LIKE operator for meta_query

@Rahmon Rahmon requested a review from felipeelia April 5, 2021 13:40
@Rahmon Rahmon self-assigned this Apr 5, 2021
@Rahmon Rahmon force-pushed the feature/not-like-meta-query-issue-2015 branch 2 times, most recently from a2865d3 to f59d229 Compare April 5, 2021 13:52
@Rahmon Rahmon added this to the 3.6.0 milestone Apr 5, 2021
@Rahmon Rahmon force-pushed the feature/not-like-meta-query-issue-2015 branch from f59d229 to 1d7ee11 Compare April 5, 2021 13:55
Rahmon and others added 2 commits April 5, 2021 10:57
Co-authored-by: Thalvik <Thalvik@users.noreply.github.com>
@Rahmon Rahmon force-pushed the feature/not-like-meta-query-issue-2015 branch from 1d7ee11 to 6386d24 Compare April 5, 2021 14:04
@brandwaffle brandwaffle merged commit 3966954 into develop Apr 16, 2021
@brandwaffle brandwaffle deleted the feature/not-like-meta-query-issue-2015 branch April 16, 2021 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: implement 'NOT LIKE' operator for meta_query
3 participants