[wp-trac] [WordPress Trac] #42423: redirect_guess_404_permalink passes array of post types with single placeholder

WordPress Trac noreply at wordpress.org
Thu Nov 2 20:02:03 UTC 2017


#42423: redirect_guess_404_permalink passes array of post types with single
placeholder
--------------------------+-----------------------------
 Reporter:  augustuswm    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Canonical     |    Version:  4.8.3
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I am not familiar enough with WordPress to know if this is an issue or
 intended.

 redirect_guess_404_permalink  has a block that looks like:

 wp-includes/canonical.php:594
 {{{#!php
 // 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'));
 else
   $where .= " AND post_type IN ('" . implode( "', '", get_post_types(
 array( 'public' => true ) ) ) . "')";
 }}}

 This works in the case that post_type is a single value, but if it has
 been changed to an array of values then this looks to trigger the warning:

 wp-includes/wp-db.php:1353
 {{{#!php
 _doing_it_wrong( 'wpdb::prepare', __( 'The query only expected one
 placeholder, but an array of multiple placeholders was sent.' ), '4.9.0'
 );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42423>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list