Index: src/wp-includes/class-wp-editor.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/wp-includes/class-wp-editor.php	(revision da4dd8eb56d3cb9e61af1f7b3c4cd03f6e871655)
+++ src/wp-includes/class-wp-editor.php	(revision )
@@ -1624,47 +1624,50 @@
 		$get_posts = new WP_Query;
 		$posts = $get_posts->query( $query );
 		// Check if any posts were found.
-		if ( ! $get_posts->post_count )
-			return false;
-
-		// Build results.
-		$results = array();
-		foreach ( $posts as $post ) {
-			if ( 'post' == $post->post_type )
-				$info = mysql2date( __( 'Y/m/d' ), $post->post_date );
-			else
-				$info = $pts[ $post->post_type ]->labels->singular_name;
-
-			$results[] = array(
-				'ID' => $post->ID,
-				'title' => trim( esc_html( strip_tags( get_the_title( $post ) ) ) ),
-				'permalink' => get_permalink( $post->ID ),
-				'info' => $info,
-			);
-		}
-
+		if ( ! $get_posts->post_count ) {
-		/**
-		 * Filters the link query results.
-		 *
-		 * Allows modification of the returned link query results.
-		 *
-		 * @since 3.7.0
-		 *
-		 * @see 'wp_link_query_args' filter
-		 *
-		 * @param array $results {
-		 *     An associative array of query results.
-		 *
-		 *     @type array {
-		 *         @type int    $ID        Post ID.
-		 *         @type string $title     The trimmed, escaped post title.
-		 *         @type string $permalink Post permalink.
-		 *         @type string $info      A 'Y/m/d'-formatted date for 'post' post type,
-		 *                                 the 'singular_name' post type label otherwise.
-		 *     }
-		 * }
-		 * @param array $query  An array of WP_Query arguments.
-		 */
+      /**
+       * Filters the link query results.
+       *
+       * Allows modification of the returned link query results.
+       *
+       * @since 3.7.0
+       *
+       * @see 'wp_link_query_args' filter
+       *
+       * @param array $results {
+       *     An associative array of query results.
+       *
+       *     @type array {
+       *         @type int    $ID        Post ID.
+       *         @type string $title     The trimmed, escaped post title.
+       *         @type string $permalink Post permalink.
+       *         @type string $info      A 'Y/m/d'-formatted date for 'post' post type,
+       *                                 the 'singular_name' post type label otherwise.
+       *     }
+       * }
+       * @param array $query  An array of WP_Query arguments.
+       */
+      $results = apply_filters( 'wp_link_query', $results, $query );
+      return !empty( $results ) ? $results : false;
+    }
+
+		// Build results.
+		$results = array();
+		foreach ( $posts as $post ) {
+			if ( 'post' == $post->post_type )
+				$info = mysql2date( __( 'Y/m/d' ), $post->post_date );
+			else
+				$info = $pts[ $post->post_type ]->labels->singular_name;
+
+			$results[] = array(
+				'ID' => $post->ID,
+				'title' => trim( esc_html( strip_tags( get_the_title( $post ) ) ) ),
+				'permalink' => get_permalink( $post->ID ),
+				'info' => $info,
+			);
+		}
+
+		/** This filter is documented at first usage above */
 		return apply_filters( 'wp_link_query', $results, $query );
 	}
 
