From ced26e78ea9d52bf1840347e8b3a03d624c1cf01 Mon Sep 17 00:00:00 2001 From: Tetrakern <26898880+Tetrakern@users.noreply.github.com> Date: Thu, 31 Oct 2024 13:13:01 +0100 Subject: [PATCH] Fix "doing it wrong" error --- includes/functions/_helpers-query.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/functions/_helpers-query.php b/includes/functions/_helpers-query.php index b4bb2bb5..26ba6ea3 100644 --- a/includes/functions/_helpers-query.php +++ b/includes/functions/_helpers-query.php @@ -799,7 +799,11 @@ if ( ! function_exists( 'fictioneer_sql_get_chapter_story_selection' ) ) { $sql .= " ORDER BY p.post_date DESC"; // Execute - $results = $wpdb->get_results( $wpdb->prepare( $sql, ...$values ) ); + if ( empty( $values ) ) { + $results = $wpdb->get_results( $sql ); + } else { + $results = $wpdb->get_results( $wpdb->prepare( $sql, ...$values ) ); + } // Populate the stories array foreach ( $results as $story ) {