• When doing a search on the default language with Polylang with the “Hide URL language information for default language” option set the language term doesn’t seem to be included in the query and the same notice that https://www.ads-software.com/support/topic/undefined-variable-term_id mentions is shown.

    By adding something like this on line 149 in version 3.4.2 it seems to be possible to solve:

    if ($row['field'] == 'term_taxonomy_id') {
    	$term_tax_id = is_array($row['terms']) ? $row['terms'] : array($row['terms']);
    } else if (...)

    The problem is that the “term_taxonomy_id” field isn’t expected by the current query builder and that’s what appears to be sent in when using the hidden default language of Polylang.

    https://www.ads-software.com/plugins/relevanssi/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mikko Saari

    (@msaari)

    I can’t even find the part of the code in Relevanssi you’re referring to, so please elaborate.

    Thread Starter VoxPelli

    (@voxpelli)

    Seems like I got the wrong line number – the correct one would be 134 and the if-statement to be prepended would be this one:

    if (!isset($row['include_children']) || $row['include_children'] == true) {
    	if (!is_array($term_id)) {
    		$term_id = array($term_id);
    	}
    	foreach ($term_id as $t_id) {
    		$kids = get_term_children($t_id, $row['taxonomy']);
    		foreach ($kids as $kid) {
    			$term = get_term_by('id', $kid, $row['taxonomy']);
    			$term_tax_id[] = relevanssi_get_term_tax_id('id', $kid, $row['taxonomy']);
    		}
    	}
    }

    Direct link to relevant code: https://plugins.trac.www.ads-software.com/browser/relevanssi/trunk/lib/search.php#L134

    Plugin Author Mikko Saari

    (@msaari)

    Can you show me the complete tax_query object your search is passing to Relevanssi? Put var_dump($tax_query); somewhere above if (is_array($tax_query)) { and tell me what it prints out.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Doesn't support Polylang hidden default language’ is closed to new replies.