Support » Plugin: Polylang » relevanssi/lib/search.php:135 – Notice: Undefined variable: term_id

  • I’m getting this error when searching only the default language using Relevanssi

    Undefined variable: term_id
    Call Stack:
    Plugin: relevanssi

    I brought up the issue on Relvanssi’s support forum, but even with a proposed fix I get this response from the author:

    Relevanssi isn’t supposed to support term_taxonomy_id, because according to WordPress documentation, that’s not an option. Legal values are term_id, name and slug.

    Also, Relevanssi already handles the Polylang support elsewhere, so this taxonomy parameter is not even needed.

    The best solution would be to clear out the taxonomy parameter so that Relevanssi doesn’t see it. Other way to handle it would be to modify the taxonomy query so that it’s passing a slug (like it’s doing for Chinese in your code) or a term_id.

    Do you think this an issue w/Polylang or Relevanssi? I can mute the error with a little extra check but the author doesn’t want to modify his code based on the reasons above.



    => Array
        [taxonomy] => language
        [field] => term_taxonomy_id
        [terms] => 81
        [operator] => IN


    => Array
        [taxonomy] => language
        [terms] => Array
                [0] => zh_tw
        [field] => slug
        [operator] => IN
        [include_children] => 1

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Chouby



    When I add a language to a query, I use ‘term_taxonomy_id’ instead of ‘slug’ to save one DB query (in fact WP uses the term_taxonomy_id internally and makes on DB query to transform the slug in term_taxonomy_id). I believe that this is supported since WP 3.5 and I introduced this optimization in Polylang 1.3. You may still have queries with the slug as I don’t modify those which already have a language.

    because according to WordPress documentation, that’s not an option. Legal values are term_id, name and slug

    Not a problem, I just updated the codex to add term_taxonomy_id. My own source is the WordPress code:

    I am using searchWP, wight is working like relevanssi pro, and have no issus. maybe you have to use this Plugin for searching.

    Thread Starter Jesse Graupmann


    It’s a great plugin, it just needs to support term_taxonomy_id.

    Thanks for your help again Chouby!

    Thread Starter Jesse Graupmann


    This has been resolved with Relevanssi 3.5.2

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘relevanssi/lib/search.php:135 – Notice: Undefined variable: term_id’ is closed to new replies.