WordPress.org

Forums

Relevanssi - A Better Search
query taxonomy in url stop working (7 posts)

  1. AliMH
    Member
    Posted 1 year ago #

    hey,
    I'm using relevanssi 3.3 but when i update to 3.3.1 (or higher) my search doesn't work properly
    http://animup.net/?s=frozen&post_types=animes&types=animation&orderby=relevance_score&order=DESC
    with 3.3 it types=animation work perfectly but when i update to 3.3.1 types.animation doesn't effect search result and show all results from animes post types.

    https://wordpress.org/plugins/relevanssi/

  2. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    There shouldn't be any difference between 3.3 and later versions in this respect. Anyway, it's better to use a tax_query anyway: http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters

  3. AliMH
    Member
    Posted 1 year ago #

    here is the result after update to 3.3.4
    http://animup.net/?s=frozen&post_types=animes&types=animation&orderby=relevance_score&order=DESC
    it show two result one is anime and second is animation

  4. AliMH
    Member
    Posted 1 year ago #

    oh sorry i have this problem from 3.3 or higher and have no problem with 3.2

  5. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    Again, I would recommend using tax_query to set the parameters with the relevanssi_modify_wp_query filter hook. That way it certainly works.

  6. AliMH
    Member
    Posted 1 year ago #

    hum, can you help me with some example how to do it?
    i have a taxonomy named: anime_types
    terms: anime,animation,manga,comic
    really sorry i really dont know how to format my code to relevansi

    add_filter('relevanssi_modify_wp_query', 'rlv_interpret_parameters'); function rlv_interpret_parameters($query) { return $query; }
  7. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    This is basically it:

    add_filter('relevanssi_modify_wp_query', 'rlv_interpret_parameters');
    function rlv_interpret_parameters($query) {
        if (!empty($query->query_vars['anime_types'])) {
            $tax_query = array(
            	array(
            		'taxonomy' => 'anime_types',
            		'field' => 'slug',
            		'terms' => $query->query_vars['anime_types']
            	)
            );
            $query->set('tax_query', $tax_query);
        }
    return $query; }

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Relevanssi - A Better Search
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags