From 977a52a0c7fb3cebc715534137ffba4028fdade9 Mon Sep 17 00:00:00 2001
From: Viliam Kopecky <vk@viliamkopecky.cz>
Date: Wed, 19 Sep 2018 11:28:49 +0200
Subject: [PATCH] WORDPRESS BUGFIX!!!

---
 public/wp-includes/canonical.php | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/public/wp-includes/canonical.php b/public/wp-includes/canonical.php
index 03c51f1..304a6dd 100644
--- a/public/wp-includes/canonical.php
+++ b/public/wp-includes/canonical.php
@@ -32,7 +32,7 @@
  * @global bool $is_IIS
  * @global WP_Query $wp_query
  * @global wpdb $wpdb WordPress database abstraction object.
- * @global WP $wp Current WordPress environment instance. 
+ * @global WP $wp Current WordPress environment instance.
  *
  * @param string $requested_url Optional. The URL that was requested, used to
  *		figure if redirect is needed.
@@ -613,8 +613,13 @@ function redirect_guess_404_permalink() {
 		$where = $wpdb->prepare("post_name LIKE %s", $wpdb->esc_like( get_query_var('name') ) . '%');
 
 		// if any of post_type, year, monthnum, or day are set, use them to refine the query
-		if ( get_query_var('post_type') )
-			$where .= $wpdb->prepare(" AND post_type = %s", get_query_var('post_type'));
+		if ( get_query_var('post_type') ) {
+			$post_type = get_query_var('post_type');
+			if ( is_array($post_type) )
+				$where .= $wpdb->prepare(' AND post_type IN (' . implode(', ', array_fill(0, count($post_type), '%s')) . ')', $post_type);
+			else
+				$where .= $wpdb->prepare(" AND post_type = %s", $post_type);
+		}
 		else
 			$where .= " AND post_type IN ('" . implode( "', '", get_post_types( array( 'public' => true ) ) ) . "')";
 
-- 
2.17.1 (Apple Git-112)

