How do I improve this admin query snippet to avoid generating duplicate results on non-meta searches?
A GROUP BY statement can group your posts after the JOIN. For WordPress you can use the posts_groupby filter. add_filter( ‘posts_groupby’, ‘my_post_limits’ ); function my_post_limits($groupby) { global $pagenow, $wpdb; if ( is_admin() && $pagenow == ‘edit.php’ && $_GET[‘post_type’]==’listings’ && $_GET[‘s’] != ” ) { $groupby = “$wpdb->posts.ID”; } return $groupby; }