wpdb::prepare bug
-
After the last update (4.1.16) we’ve started seeing the following PHP errors:
Function wpdb::prepare was called incorrectly. The query does not contain the correct number of placeholders (1) for the number of arguments passed (3).
Digging further, the issue seems to be on line 173 in class-googlesitemapgeneratorstandardbuilder.php:
$q = $wpdb->prepare( $qs, $post_type, $year, $month );
Where $qs is given by:
$qs = " SELECT p.ID, p.post_author, p.post_status, p.post_name, p.post_parent, p.post_type, p.post_date, p.post_date_gmt, p.post_modified, p.post_modified_gmt, p.comment_count FROM {$wpdb->posts} p WHERE p.post_password = '' AND p.post_type = '%s' AND p.post_status = 'publish' {$ex_post_s_q_l} {$ex_cat_s_q_l} ORDER BY p.post_date_gmt DESC LIMIT {$limit} ";
So presumably line 173 just needs changing to this?
$q = $wpdb->prepare( $qs, $post_type );
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘wpdb::prepare bug’ is closed to new replies.