Index: src/wp-includes/query.php
===================================================================
--- src/wp-includes/query.php	(revision 36344)
+++ src/wp-includes/query.php	(working copy)
@@ -3531,6 +3531,26 @@
 		}
 
 		if ( 'ids' == $q['fields'] ) {
+
+			/**
+			 * Filter the query results when 'fields' specified in a query.
+			 *
+			 * Plugins can bypass a 'fields' query by returning
+			 * an array of posts to be returned from the query.
+			 *
+			 * @since 4.5.0
+			 *
+			 * @param array    $posts   The filtered array of posts.
+			 * @param array    $request The complete SQL query.
+			 * @param string   $fields  The query 'fields' value.
+			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
+			 */
+			$this->posts = apply_filters_ref_array( 'fields_the_posts', array( false, $q['fields'], $this->request, &$this ) );
+
+			if ( false !== $this->posts ) {
+				return $this->posts;
+			}
+
 			$this->posts = $wpdb->get_col( $this->request );
 			$this->posts = array_map( 'intval', $this->posts );
 			$this->post_count = count( $this->posts );
@@ -3540,6 +3560,14 @@
 		}
 
 		if ( 'id=>parent' == $q['fields'] ) {
+
+			/** This filter is documented in wp-includes/query.php */
+			$this->posts = apply_filters_ref_array( 'fields_the_posts', array( false, $q['fields'], $this->request, &$this ) );
+
+			if ( false !== $this->posts ) {
+				return $this->posts;
+			}
+
 			$this->posts = $wpdb->get_results( $this->request );
 			$this->post_count = count( $this->posts );
 			$this->set_found_posts( $q, $limits );
