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

Fix: EP returns nothing when an invalid value is passed to the tax_query field parameter #3030

Merged
merged 8 commits into from
Oct 17, 2022

Conversation

burhandodhy
Copy link
Contributor

Description of the Change

This PR fixes the issue where the EP returns no post when the invalid value passes to field parameter to tax_query.

Closes #3025

How to test the Change

Use the below snippet. It should return the posts

add_action( 'init',function() : void {


	$args = array(
		'ep_integrate' => true,
		'posts_per_page'  => 10,
		'tax_query' => array(
			array(
				'taxonomy' => 'category',
				'field'    => 'id', // invalid field name
				'terms'    => termID, // update the value
			),
		),
	);
	$query = new \WP_Query( $args );
	if ( $query->have_posts() ) : ?>
			<?php while ( $query->have_posts() ) : $query->the_post(); ?>
				<?php the_title(); ?>
			<?php endwhile; ?>
	<?php endif; ?>
	<?php wp_reset_postdata();
}  );

Changelog Entry

Fixed - Returns no posts when an invalid value is passed to the tax_query field parameter

Credits

Props @burhandodhy

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.

@burhandodhy burhandodhy added this to the 4.4.0 milestone Sep 29, 2022
Copy link
Member

@felipeelia felipeelia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor change @burhandodhy (and a git conflict that needs to be fixed.) Thanks!

includes/classes/Indexable/Post/Post.php Outdated Show resolved Hide resolved
@felipeelia felipeelia assigned burhandodhy and unassigned felipeelia Oct 11, 2022
@felipeelia felipeelia merged commit 19db94a into develop Oct 17, 2022
@felipeelia felipeelia deleted the burhan/fix-3025 branch October 17, 2022 16:04
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

Successfully merging this pull request may close these issues.

BUG: EP returns nothing when an invalid value is passed to the tax_query field parameter.
2 participants