WordPress.org

Make WordPress Core

Ticket #44964: ticket_44964_fix.patch

File ticket_44964_fix.patch, 1.7 KB (added by viliamkopecky, 3 years ago)

patch with fix

  • public/wp-includes/canonical.php

    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 b  
    3232 * @global bool $is_IIS
    3333 * @global WP_Query $wp_query
    3434 * @global wpdb $wpdb WordPress database abstraction object.
    35  * @global WP $wp Current WordPress environment instance. 
     35 * @global WP $wp Current WordPress environment instance.
    3636 *
    3737 * @param string $requested_url Optional. The URL that was requested, used to
    3838 *              figure if redirect is needed.
    function redirect_guess_404_permalink() { 
    613613                $where = $wpdb->prepare("post_name LIKE %s", $wpdb->esc_like( get_query_var('name') ) . '%');
    614614
    615615                // if any of post_type, year, monthnum, or day are set, use them to refine the query
    616                 if ( get_query_var('post_type') )
    617                         $where .= $wpdb->prepare(" AND post_type = %s", get_query_var('post_type'));
     616                if ( get_query_var('post_type') ) {
     617                        $post_type = get_query_var('post_type');
     618                        if ( is_array($post_type) )
     619                                $where .= $wpdb->prepare(' AND post_type IN (' . implode(', ', array_fill(0, count($post_type), '%s')) . ')', $post_type);
     620                        else
     621                                $where .= $wpdb->prepare(" AND post_type = %s", $post_type);
     622                }
    618623                else
    619624                        $where .= " AND post_type IN ('" . implode( "', '", get_post_types( array( 'public' => true ) ) ) . "')";
    620625