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

    Notice:
    
    Undefined variable: term_id
    
    Location:
    
    wp-content/plugins/relevanssi/lib/search.php:135
    
    Call Stack:
    
    relevanssi_search()
    relevanssi_do_query()
    relevanssi_query()
    apply_filters_ref_array('the_posts')
    WP_Query->get_posts()
    WP_Query->query()
    WP->query_posts()
    WP->main()
    wp()
    
    Component:
    
    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.

    Thoughts?

    English

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

    Chinese

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

    https://wordpress.org/plugins/polylang/

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

    (@chouby)

    Hi!

    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: https://core.trac.wordpress.org/browser/tags/4.3.1/src/wp-includes/taxonomy.php#L755

    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

    (@jgraup)

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

    Thanks for your help again Chouby!

    Thread Starter Jesse Graupmann

    (@jgraup)

    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.