Make WordPress Core

Opened 7 months ago

#42423 new defect (bug)

redirect_guess_404_permalink passes array of post types with single placeholder

Reported by: augustuswm Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.8.3
Component: Canonical Keywords:
Focuses: Cc:


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:


// 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'));
  $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:


_doing_it_wrong( 'wpdb::prepare', __( 'The query only expected one placeholder, but an array of multiple placeholders was sent.' ), '4.9.0' );

Change History (0)

Note: See TracTickets for help on using tickets.