Duplicate posts being displayed when querying Custom Fields June 2, 2022 by Tarik Billa just add to your query SELECT DISTINCT $wpdb->posts. instead of SELECT $wpdb->posts.