﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
22213,split_the_query breaks posts_distinct filter,johnbillion,,"If you add a DISTINCT value to a query using the `posts_distinct` filter then the functionality which splits a query (#18536) breaks because the values from your DISTINCT field are used instead of the ID field.

Example:

{{{
add_filter( 'posts_distinct', function( $val ) {
	return 'DISTINCT post_author as pa, ';
} );
}}}

When the split query runs it uses `$wpdb->get_col()` which will return the DISTINCT field values we asked for instead of the ID fields. In the example above we get an array of post author IDs instead of post IDs.

To get around this problem the split query had to be disabled for this request with the `split_the_query` filter.",defect (bug),closed,normal,,Query,3.4,normal,invalid,has-patch 2nd-opinion,
