Title: [Plugin: Relevanssi] Error in error_log_php
Last modified: August 19, 2016

---

# [Plugin: Relevanssi] Error in error_log_php

 *  Resolved [GuidoCimurro](https://wordpress.org/support/users/guidocimurro/)
 * (@guidocimurro)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-relevanssi-error-in-error_log_php/)
 * Hi and thank-you very much for your plugin.
    Relevanssi work very well, but I
   find this error in my error_log_php.log for every searching:
 * WordPress errore sul database You have an error in your SQL syntax; check the
   manual that corresponds to your MySQL server version for the right syntax to 
   use near ” at line 2 per la query SELECT term_taxonomy_id FROM wp_term_taxonomy
   WHERE term_id= fatta da require, wp, WP->main, WP->query_posts, WP_Query->query,
   WP_Query->get_posts, apply_filters_ref_array, call_user_func_array, relevanssi_query,
   relevanssi_search
 * I’m running MySql 5.1.48-log.
 * Thank you.
 * [http://wordpress.org/extend/plugins/relevanssi/](http://wordpress.org/extend/plugins/relevanssi/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-relevanssi-error-in-error_log_php/#post-1630481)
 * 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?
 *  Thread Starter [GuidoCimurro](https://wordpress.org/support/users/guidocimurro/)
 * (@guidocimurro)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-relevanssi-error-in-error_log_php/#post-1630523)
 * Same error for every search.
 * WordPress 3.0.1
    Relevanssi 2.0.3
 * Thank-you for your helping!
 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/plugin-relevanssi-error-in-error_log_php/#post-1630567)
 * 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.
 *  Thread Starter [GuidoCimurro](https://wordpress.org/support/users/guidocimurro/)
 * (@guidocimurro)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/plugin-relevanssi-error-in-error_log_php/#post-1630577)
 * 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.
 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/plugin-relevanssi-error-in-error_log_php/#post-1630614)
 * 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;
       	}
       ```
   
 *  Thread Starter [GuidoCimurro](https://wordpress.org/support/users/guidocimurro/)
 * (@guidocimurro)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/plugin-relevanssi-error-in-error_log_php/#post-1630623)
 * That’s great! Thank-you so much!
 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/plugin-relevanssi-error-in-error_log_php/#post-1630643)
 * I just released 2.1, which includes the fix.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘[Plugin: Relevanssi] Error in error_log_php’ is closed to new replies.

 * ![](https://ps.w.org/relevanssi/assets/icon-256x256.png?rev=3529670)
 * [Relevanssi - A Better Search](https://wordpress.org/plugins/relevanssi/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/relevanssi/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/relevanssi/)
 * [Active Topics](https://wordpress.org/support/plugin/relevanssi/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/relevanssi/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/relevanssi/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * Last activity: [15 years, 9 months ago](https://wordpress.org/support/topic/plugin-relevanssi-error-in-error_log_php/#post-1630643)
 * Status: resolved