Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder
There are 2 places that could have issues: Your first wpdb::prepare() here: // Prepare and execute the count query $count_query = $wpdb->prepare( $count_sql, …$query_params ); The initial value you set for $count_sql is “SELECT COUNT(*) FROM $table_name WHERE 1=1”, and if $filters doesn’t have any key matching your switch, the value of $count_sql will remain … Read more