Last active
July 21, 2017 00:01
-
-
Save ChrisFlannagan/73bf8b7c892a1e3106e8b16991875863 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$distinct_ids = function ( $groupby ) { | |
global $wpdb; | |
return "{$wpdb->posts}.ID"; | |
}; | |
add_filter( 'posts_groupby', $distinct_ids ); | |
$posts = get_posts( $args ); | |
remove_filter( 'posts_groupby', $distinct_ids ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment