WordPress.org

Make WordPress Core

Ticket #42423: 42423.diff

File 42423.diff, 816 bytes (added by nikhiltechahead, 2 years ago)

Remove warning in redirect_guess_404_permalink. It supports post_type only single-case-string but this could be array or string both.

  • wp-includes/canonical.php

    diff --git a/wp-includes/canonical.php b/wp-includes/canonical.php
    index 36ff320..ca164f1 100644
    a b function redirect_guess_404_permalink() { 
    665665
    666666                // if any of post_type, year, monthnum, or day are set, use them to refine the query
    667667                if ( get_query_var( 'post_type' ) ) {
    668                         $where .= $wpdb->prepare( ' AND post_type = %s', get_query_var( 'post_type' ) );
     668                        if ( is_array( get_query_var( 'post_type' ) ) ) {
     669                                $where .= " AND post_type IN ('" . implode( "', '", get_query_var('post_type') ) . "')";
     670                        } else {
     671                                $where .= $wpdb->prepare(" AND post_type = %s", get_query_var('post_type'));
     672                        }
    669673                } else {
    670674                        $where .= " AND post_type IN ('" . implode( "', '", get_post_types( array( 'public' => true ) ) ) . "')";
    671675                }