Sounds odd. Every search? Does anything change in the error message, is it always the same? You’re running WP 3.0.1, apparently, but which version of Relevanssi? The latest?
Same error for every search.
WordPress 3.0.1
Relevanssi 2.0.3
Thank-you for your helping!
There are actually three MySQL queries like that in the source code, so figuring this out is pretty hard without knowing which one it is… But I’d still say it’s something in your setup, as I haven’t seen similar errors on my sites.
I solved excluding the third query
if (isset($taxonomy)) {
$term_id = $wpdb->get_var(“SELECT term_id FROM $wpdb->terms WHERE name LIKE ‘$taxonomy_term'”);
$term_tax_id = $wpdb->get_var(“SELECT term_taxonomy_id FROM $wpdb->term_taxonomy
WHERE term_id=$term_id”);
$taxonomy = $term_tax_id;
}
with
//if (isset($taxonomy)) {
if (1==2) {
$term_id = $wpdb->get_var(“SELECT term_id FROM $wpdb->terms WHERE name LIKE ‘$taxonomy_term'”);
$term_tax_id = $wpdb->get_var(“SELECT term_taxonomy_id FROM $wpdb->term_taxonomy
WHERE term_id=$term_id”);
$taxonomy = $term_tax_id;
}
Is that query to scan custom taxonomies?
Thanks and sorry for my bad english.
Yes, this one is custom taxonomies. I’m not 100% sure, but I think the error message is protesting the fact the $term_id is empty. So, I suppose this should be fixed with a simple check to make sure $term_id actually contains something. Problem solved?
Replace the code with this bit and tell me what happens:
if (isset($taxonomy)) {
$term_tax_id = null;
$term_id = $wpdb->get_var("SELECT term_id FROM $wpdb->terms WHERE name LIKE '$taxonomy_term'");
if ($term_id) {
$term_tax_id = $wpdb->get_var("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy
WHERE term_id=$term_id");
}
$taxonomy = $term_tax_id;
}
That’s great! Thank-you so much!
I just released 2.1, which includes the fix.