diff --git a/src/wp-includes/canonical.php b/src/wp-includes/canonical.php
index 5a63de3481..08bb08a617 100644
--- a/src/wp-includes/canonical.php
+++ b/src/wp-includes/canonical.php
@@ -897,7 +897,11 @@ function redirect_guess_404_permalink() {
 
 		// 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 ( is_array( get_query_var( 'post_type' ) ) ) {
+				$where .= $wpdb->prepare( ' AND post_type IN (%s)', implode( ',', esc_sql( get_query_var( 'post_type' ) ) ) );
+			} else {
+				$where .= $wpdb->prepare( ' AND post_type = %s', get_query_var( 'post_type' ) );
+			}
 		} else {
 			$where .= " AND post_type IN ('" . implode( "', '", get_post_types( array( 'public' => true ) ) ) . "')";
 		}
