term_relationships insert bug
-
A clients import was failing so I dug into their code to see what’s up. I think I found an query bug in the /src/ACFService.php file. Check out line 293. You’re preparing a query to insert groups of 3 term_relationships values. Your implode statement however will output the (%d, %d, %d) string three times even if there are only three values. Should count( $values ) be divided by three in this case?
if ( false === $wpdb->query( $wpdb->prepare( “INSERT INTO {$wpdb->term_relationships} (object_id, term_taxonomy_id, term_order) VALUES ” . implode( ‘, ‘, array_fill( 0, count( $values ), “(%d, %d, %d)” ) ) . ” ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)”, …$values ) ) ) {
You must be logged in to reply to this topic.